2023-03-12 03:28:32 +00:00
|
|
|
-- https://neovim.io/doc/user/lua-guide.html
|
2023-05-30 14:38:48 +00:00
|
|
|
vim.opt.completeopt = { "menuone", "noinsert", "noselect", "preview" }
|
2022-09-21 03:37:23 +00:00
|
|
|
vim.opt.swapfile = false
|
|
|
|
vim.opt.title = true
|
2022-07-30 18:30:59 +00:00
|
|
|
vim.opt.virtualedit = "block"
|
|
|
|
vim.opt.whichwrap = "<,>,[,]"
|
|
|
|
|
2023-05-19 09:43:12 +00:00
|
|
|
-- Case character
|
|
|
|
vim.opt.ignorecase = true
|
|
|
|
vim.opt.smartcase = true
|
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Line number
|
|
|
|
vim.opt.number = true
|
|
|
|
vim.opt.relativenumber = true
|
|
|
|
vim.opt.scrolloff = 4
|
|
|
|
|
|
|
|
-- Tab
|
|
|
|
vim.opt.tabstop = 4
|
|
|
|
vim.opt.shiftwidth = 4
|
|
|
|
vim.opt.expandtab = true
|
|
|
|
|
|
|
|
-- Wrap
|
|
|
|
vim.opt.breakindent = true
|
|
|
|
|
2023-03-20 06:22:29 +00:00
|
|
|
-- Clipboard support
|
2023-04-02 18:35:22 +00:00
|
|
|
vim.opt.clipboard = "unnamedplus"
|
2023-03-20 06:22:29 +00:00
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Truecolor
|
|
|
|
if vim.env.COLORTERM == "truecolor" then
|
|
|
|
vim.opt.termguicolors = true
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Mouse support
|
|
|
|
vim.opt.mouse = "a"
|
|
|
|
|
|
|
|
-- Workaround
|
|
|
|
-- https://github.com/neovim/neovim/issues/16416
|
|
|
|
vim.keymap.set("i", "<C-c>", "<Esc>")
|
|
|
|
|
|
|
|
-- Keymap
|
2023-04-18 10:17:20 +00:00
|
|
|
vim.keymap.set("n", ";", "<leader>", { remap = true })
|
2023-05-14 14:05:33 +00:00
|
|
|
vim.keymap.set("n", "q", ":q<CR>")
|
2023-04-18 03:52:55 +00:00
|
|
|
|
|
|
|
-- Keymap for plugin
|
2023-05-10 17:54:11 +00:00
|
|
|
vim.keymap.set("n", "<leader>f", ":FZF<CR>")
|
2023-03-06 04:45:32 +00:00
|
|
|
vim.keymap.set("n", "<leader>rg", ":Rg<CR>")
|
2022-09-21 03:37:23 +00:00
|
|
|
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
|
|
|
|
vim.keymap.set("n", "<leader>n", ":NvimTreeFindFile<CR>")
|
2023-04-26 05:57:22 +00:00
|
|
|
vim.keymap.set("n", "<leader>z", ":ZenMode<CR>")
|
2023-02-28 03:34:59 +00:00
|
|
|
vim.keymap.set("n", "<F2>", ":GoRename<CR>")
|
2023-03-06 04:25:25 +00:00
|
|
|
vim.keymap.set("n", "<leader>gf", ":GoFillStruct<CR>:w<CR>")
|
2023-05-05 15:58:26 +00:00
|
|
|
vim.keymap.set("n", "<leader>gat", ":GoAlternate<CR>")
|
|
|
|
vim.keymap.set("n", "<leader>gt", ":GoTest<CR>")
|
2023-03-25 03:31:37 +00:00
|
|
|
vim.keymap.set("n", "<leader>gr", ":GoReferrers<CR>")
|
2023-04-04 17:57:15 +00:00
|
|
|
vim.keymap.set("n", "<leader>gcv", ":GoCoverage<CR>")
|
2023-04-11 10:47:00 +00:00
|
|
|
vim.keymap.set("n", "<leader>gdd", ":GoDeclsDir<CR>")
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2023-04-18 03:52:55 +00:00
|
|
|
-- Use fzf
|
|
|
|
vim.opt.rtp:append({ "~/.fzf" })
|
2023-03-11 14:02:41 +00:00
|
|
|
|
2023-04-12 07:09:54 +00:00
|
|
|
-- Use plugin nvim-tree.lua
|
|
|
|
vim.g.loaded_netrw = 1
|
|
|
|
vim.g.loaded_netrwPlugin = 1
|
|
|
|
|
2023-03-11 14:16:39 +00:00
|
|
|
-- Use plugin neoformat
|
2023-05-30 18:08:54 +00:00
|
|
|
vim.g.neoformat_basic_format_trim = 1
|
2023-03-11 14:16:39 +00:00
|
|
|
vim.g.neoformat_enabled_go = { "gofumpt" }
|
|
|
|
vim.g.shfmt_opt = "-ci"
|
|
|
|
|
2023-03-11 14:02:41 +00:00
|
|
|
-- Use plugin vim-go
|
2022-09-21 03:37:23 +00:00
|
|
|
vim.g.go_gopls_gofumpt = 1
|
|
|
|
vim.g.go_doc_popup_window = 1
|
|
|
|
|
2023-03-11 14:02:41 +00:00
|
|
|
-- Use plugin copilot
|
2022-09-21 03:37:23 +00:00
|
|
|
vim.g.copilot_filetypes = {
|
|
|
|
["*"] = false,
|
|
|
|
go = true,
|
2023-02-25 14:35:42 +00:00
|
|
|
json = true,
|
2023-02-28 09:00:43 +00:00
|
|
|
lua = true,
|
2023-02-28 03:34:59 +00:00
|
|
|
make = true,
|
2022-09-21 03:37:23 +00:00
|
|
|
proto = true,
|
2023-02-25 14:35:42 +00:00
|
|
|
python = true,
|
2023-02-28 09:00:43 +00:00
|
|
|
toml = true,
|
2023-03-06 04:25:25 +00:00
|
|
|
yaml = true,
|
|
|
|
markdown = true,
|
2022-09-21 03:37:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-- https://github.com/wbthomason/packer.nvim
|
|
|
|
require("packer").startup(function()
|
|
|
|
-- Manage itself
|
|
|
|
use("wbthomason/packer.nvim")
|
|
|
|
|
2023-04-18 03:52:55 +00:00
|
|
|
-- https://github.com/junegunn/fzf.vim
|
|
|
|
use("junegunn/fzf.vim")
|
2022-09-21 03:37:23 +00:00
|
|
|
|
|
|
|
-- https://github.com/nvim-lualine/lualine.nvim
|
|
|
|
use({
|
|
|
|
"nvim-lualine/lualine.nvim",
|
|
|
|
config = function()
|
|
|
|
require("lualine").setup({
|
|
|
|
options = {
|
|
|
|
icons_enabled = false,
|
2023-03-26 16:39:01 +00:00
|
|
|
theme = "auto",
|
2023-03-17 09:28:40 +00:00
|
|
|
-- theme = "iceberg",
|
2023-03-26 16:39:01 +00:00
|
|
|
-- theme = "catppuccin",
|
2022-09-21 03:37:23 +00:00
|
|
|
component_separators = { left = "", right = "" },
|
|
|
|
section_separators = { left = "", right = "" },
|
|
|
|
},
|
|
|
|
extensions = { "fzf", "nvim-tree" },
|
|
|
|
})
|
2022-10-31 16:01:33 +00:00
|
|
|
|
|
|
|
-- Disable showmode when use lualine
|
|
|
|
vim.opt.showmode = false
|
2022-09-21 03:37:23 +00:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-12 07:09:54 +00:00
|
|
|
-- https://github.com/nvim-tree/nvim-tree.lua
|
2022-09-21 03:37:23 +00:00
|
|
|
use({
|
2023-04-12 07:09:54 +00:00
|
|
|
"nvim-tree/nvim-tree.lua",
|
2022-09-21 03:37:23 +00:00
|
|
|
config = function()
|
|
|
|
require("nvim-tree").setup({
|
|
|
|
renderer = {
|
2023-04-12 07:09:54 +00:00
|
|
|
group_empty = true,
|
2023-02-07 10:10:22 +00:00
|
|
|
icons = {
|
|
|
|
show = {
|
|
|
|
file = false,
|
|
|
|
folder = false,
|
|
|
|
folder_arrow = false,
|
|
|
|
git = false,
|
|
|
|
modified = false,
|
|
|
|
},
|
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
},
|
2023-05-24 07:10:08 +00:00
|
|
|
filters = {
|
|
|
|
custom = { "^\\.git", "^\\.DS_Store" },
|
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
})
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
-- https://github.com/lukas-reineke/indent-blankline.nvim
|
|
|
|
use({
|
|
|
|
"lukas-reineke/indent-blankline.nvim",
|
|
|
|
config = function()
|
|
|
|
require("indent_blankline").setup()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-26 05:57:22 +00:00
|
|
|
-- https://github.com/folke/zen-mode.nvim
|
|
|
|
use({
|
|
|
|
"folke/zen-mode.nvim",
|
|
|
|
config = function()
|
|
|
|
require("zen-mode").setup()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-02 17:57:22 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-bracketed.md
|
2023-02-28 09:00:43 +00:00
|
|
|
use({
|
2023-04-02 17:57:22 +00:00
|
|
|
"echasnovski/mini.bracketed",
|
2023-02-28 09:00:43 +00:00
|
|
|
config = function()
|
2023-04-02 17:57:22 +00:00
|
|
|
require("mini.bracketed").setup()
|
2023-02-28 09:00:43 +00:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-02 17:57:22 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
|
2023-03-01 09:19:40 +00:00
|
|
|
use({
|
2023-04-02 17:57:22 +00:00
|
|
|
"echasnovski/mini.comment",
|
2023-03-01 09:19:40 +00:00
|
|
|
config = function()
|
2023-04-02 17:57:22 +00:00
|
|
|
require("mini.comment").setup()
|
2023-03-01 09:19:40 +00:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-02 18:10:10 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-cursorword.md
|
|
|
|
use({
|
|
|
|
"echasnovski/mini.cursorword",
|
|
|
|
config = function()
|
|
|
|
require("mini.cursorword").setup()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-02 18:17:38 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md
|
|
|
|
use({
|
|
|
|
"echasnovski/mini.surround",
|
|
|
|
config = function()
|
|
|
|
require("mini.surround").setup()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-05-03 17:12:34 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-trailspace.md
|
|
|
|
use({
|
|
|
|
"echasnovski/mini.trailspace",
|
|
|
|
config = function()
|
|
|
|
require("mini.trailspace").setup()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Colorschemes
|
|
|
|
-- https://github.com/cocopon/iceberg.vim
|
|
|
|
use("cocopon/iceberg.vim")
|
|
|
|
|
2023-04-21 15:57:20 +00:00
|
|
|
-- https://github.com/projekt0n/github-nvim-theme
|
|
|
|
use({ "projekt0n/github-nvim-theme", branch = "0.0.x" })
|
|
|
|
|
2023-03-17 09:28:40 +00:00
|
|
|
-- https://github.com/nyoom-engineering/oxocarbon.nvim
|
|
|
|
use("nyoom-engineering/oxocarbon.nvim")
|
|
|
|
|
2022-10-31 16:01:33 +00:00
|
|
|
-- https://github.com/catppuccin/nvim
|
|
|
|
use({
|
|
|
|
"catppuccin/nvim",
|
|
|
|
as = "catppuccin",
|
|
|
|
config = function()
|
|
|
|
require("catppuccin").setup({
|
|
|
|
flavour = "mocha",
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
})
|
2022-09-26 02:30:19 +00:00
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Programming languages
|
|
|
|
-- https://github.com/sbdchd/neoformat
|
|
|
|
use("sbdchd/neoformat")
|
|
|
|
|
2023-03-11 14:02:41 +00:00
|
|
|
-- https://github.com/nvim-treesitter/nvim-treesitter
|
|
|
|
use({
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
run = function()
|
|
|
|
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
|
|
|
|
ts_update()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2023-04-03 17:47:01 +00:00
|
|
|
-- https://github.com/nvim-treesitter/nvim-treesitter-context
|
|
|
|
use({
|
|
|
|
"nvim-treesitter/nvim-treesitter-context",
|
|
|
|
config = function()
|
|
|
|
require("treesitter-context").setup({
|
|
|
|
enable = true,
|
|
|
|
max_lines = 2,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- https://github.com/fatih/vim-go
|
|
|
|
use("fatih/vim-go")
|
|
|
|
|
|
|
|
-- https://github.com/github/copilot.vim
|
|
|
|
use("github/copilot.vim")
|
|
|
|
end)
|
|
|
|
|
2022-10-31 16:01:33 +00:00
|
|
|
-- vim.api.nvim_command("colorscheme iceberg")
|
2023-04-02 18:10:10 +00:00
|
|
|
vim.api.nvim_command("colorscheme oxocarbon")
|
2023-05-30 14:34:20 +00:00
|
|
|
-- vim.api.nvim_command("colorscheme github_dark")
|
2023-04-02 18:10:10 +00:00
|
|
|
-- vim.api.nvim_command("colorscheme catppuccin")
|