fix: golang lsp action
This commit is contained in:
parent
842191f4d0
commit
08749c5930
|
@ -19,6 +19,7 @@ go install github.com/jesseduffield/lazygit@latest
|
|||
npm install eslint --global
|
||||
npm install -g typescript typescript-language-server
|
||||
npm install -g @volar/vue-language-server
|
||||
npm install -g eslint_d
|
||||
```
|
||||
|
||||
### 记忆项
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>
|
|
@ -0,0 +1,51 @@
|
|||
hi MDTask ctermfg=1
|
||||
hi MDDoneText ctermfg=37 cterm=italic,strikethrough
|
||||
hi MDTodoText cterm=NONE
|
||||
hi MDDoneDate cterm=strikethrough ctermfg=71
|
||||
hi MDTodoDate ctermfg=71
|
||||
hi Deadline ctermfg=162 cterm=bold,underline
|
||||
hi NearDeadline ctermfg=178 cterm=bold
|
||||
au FileType markdown syn match markdownError "\w\@<=\w\@="
|
||||
au FileType markdown syn match MDDoneDate /[SD]:\d\{4\}\([\/-]\d\d\)\{2\}/ contained
|
||||
au FileType markdown syn match MDTodoDate /[SD]:\d\{4\}\([\/-]\d\d\)\{2\}/ contained
|
||||
au FileType markdown syn match MDDoneText /- \[x\] \zs.*/ contains=MDDoneDate contained
|
||||
au FileType markdown syn match MDTodoText /- \[ \] \zs.*/ contains=MDTodoDate contained
|
||||
au FileType markdown syn match MDTask /- \[\(x\| \)\] .*/ contains=MDDoneText,MDTodoText
|
||||
au FileType markdown call matchadd('Deadline', 'D:'.strftime("%Y-%m-%d"))
|
||||
au FileType markdown call matchadd('NearDeadline', 'D:'.strftime("%Y-%m-%d", localtime() + 3600 * 24))
|
||||
au FileType markdown call matchadd('NearDeadline', 'D:'.strftime("%Y-%m-%d", localtime() + 3600 * 48))
|
||||
|
||||
let b:md_block = '```'
|
||||
setlocal shiftwidth=2
|
||||
setlocal softtabstop=2
|
||||
setlocal tabstop=2
|
||||
nnoremap <silent><buffer> <CR> :call <SID>toggleTodoStatus()<CR><CR>
|
||||
nnoremap <silent><buffer> <2-LeftMouse> :call <SID>toggleTodoStatus()<CR>:w<CR><2-LeftMouse>
|
||||
vnoremap <silent><buffer> B :<c-u>call SurroundVaddPairs("**", "**")<cr>
|
||||
vnoremap <silent><buffer> I :<c-u>call SurroundVaddPairs("*", "*")<cr>
|
||||
vnoremap <silent><buffer> T :<c-u>call SurroundVaddPairs("- [ ] ", "")<cr>
|
||||
vnoremap <silent><buffer> ` :<c-u>call SurroundVaddPairs("`", "`")<cr>
|
||||
vnoremap <silent><buffer> C :<c-u>call SurroundVaddPairs("```plaintext", "```")<cr>
|
||||
|
||||
fun! s:toggleTodoStatus()
|
||||
let line = getline('.')
|
||||
if line =~ glob2regpat('*- \[ \]*')
|
||||
call setline('.', substitute(line, '\[ \]', '[x]', ''))
|
||||
elseif line =~ glob2regpat('*- \[x\]*')
|
||||
call setline('.', substitute(line, '\[x\]', '[ ]', ''))
|
||||
endif
|
||||
endf
|
||||
|
||||
nnoremap <silent><buffer> <F6> :call <SID>toggleMPTheme()<CR>
|
||||
inoremap <silent><buffer> <F6> <ESC>:call <SID>toggleMPTheme()<CR>
|
||||
fun! s:toggleMPTheme()
|
||||
if g:mkdp_theme == 'dark'
|
||||
let g:mkdp_theme = 'light'
|
||||
else
|
||||
let g:mkdp_theme = 'dark'
|
||||
endif
|
||||
|
||||
exec 'MarkdownPreviewStop'
|
||||
sleep 1
|
||||
exec 'MarkdownPreview'
|
||||
endf
|
|
@ -0,0 +1 @@
|
|||
let g:omni_sql_no_default_maps = 1
|
|
@ -0,0 +1 @@
|
|||
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>
|
|
@ -0,0 +1 @@
|
|||
let g:omni_sql_no_default_maps = 1
|
|
@ -0,0 +1 @@
|
|||
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>
|
|
@ -0,0 +1,4 @@
|
|||
augroup vue
|
||||
au!
|
||||
autocmd BufWritePre *.vue :call CocAction('format')
|
||||
augroup END
|
32
init.lua
32
init.lua
|
@ -1,18 +1,16 @@
|
|||
require("impatient") -- start quickly
|
||||
require("setup")
|
||||
require("core.g")
|
||||
require("core.option")
|
||||
|
||||
-- 加载插件配置文件
|
||||
-- 文件树
|
||||
require("plugins.file-tree")
|
||||
-- 行号模式切换
|
||||
require("plugins.line-numbers")
|
||||
-- 模糊搜索
|
||||
require("plugins.telescope")
|
||||
-- 默认配置
|
||||
require("plugins.peaceful")
|
||||
-- debug 配置
|
||||
require("plugins.debug")
|
||||
-- mason管理
|
||||
require("plugins.mason")
|
||||
-- 终端管理
|
||||
require("plugins.terminal")
|
||||
-- bufferline
|
||||
require("plugins.bufferline")
|
||||
-- 空白缩进
|
||||
|
@ -20,23 +18,24 @@ require("plugins.indent_blackline")
|
|||
-- 底部状态
|
||||
require("plugins.lualine")
|
||||
-- 自动保存
|
||||
require("plugins.auto-save")
|
||||
require("plugins.auto-do")
|
||||
-- 通知
|
||||
require("plugins.notify")
|
||||
-- 格式化
|
||||
require("plugins.null-ls")
|
||||
-- 错误列表
|
||||
require("plugins.trouble")
|
||||
-- git
|
||||
require("plugins.gitsigns")
|
||||
-- 文件搜索
|
||||
require("plugins.telescope")
|
||||
-- 快速跳转
|
||||
require("plugins.leap")
|
||||
-- 代码高亮配置
|
||||
require("plugins.treesitter")
|
||||
-- lspsaga
|
||||
require("plugins.lspsaga")
|
||||
-- golang lsp
|
||||
require("plugins.golang")
|
||||
-- wilder配置
|
||||
require("plugins.wilder")
|
||||
-- 自定义快捷键配置
|
||||
require("plugins.legendary")
|
||||
-- lsp 配置
|
||||
require("lsp.init")
|
||||
require("lsp.bash")
|
||||
require("lsp.docker")
|
||||
|
@ -45,6 +44,11 @@ require("lsp.go")
|
|||
require("lsp.lua")
|
||||
require("lsp.protocol")
|
||||
require("lsp.volar")
|
||||
require("lsp.clang")
|
||||
-- lspsaga
|
||||
require("plugins.lspsaga")
|
||||
-- golang lsp
|
||||
require("plugins.golang")
|
||||
|
||||
-- 载入主题
|
||||
require("core.theme")
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
local G = {}
|
||||
|
||||
G.g = vim.g
|
||||
G.b = vim.b
|
||||
G.o = vim.o
|
||||
G.v = vim.v
|
||||
G.fn = vim.fn
|
||||
G.api = vim.api
|
||||
G.opt = vim.opt
|
||||
|
||||
function G.map(maps)
|
||||
for _, map in pairs(maps) do
|
||||
G.api.nvim_set_keymap(map[1], map[2], map[3], map[4])
|
||||
end
|
||||
end
|
||||
|
||||
function G.hi(hls)
|
||||
local colormode = G.o.termguicolors and "" or "cterm"
|
||||
for group, color in pairs(hls) do
|
||||
local opt = {}
|
||||
if color.fg then
|
||||
opt[colormode .. "fg"] = color.fg
|
||||
end
|
||||
if color.bg then
|
||||
opt[colormode .. "bg"] = color.bg
|
||||
end
|
||||
if color.italic then
|
||||
opt.italic = true
|
||||
end
|
||||
if color.bold then
|
||||
opt.bold = true
|
||||
end
|
||||
if color.underline then
|
||||
opt.underline = true
|
||||
end
|
||||
G.api.nvim_set_hl(0, group, opt)
|
||||
end
|
||||
end
|
||||
|
||||
function G.cmd(cmd)
|
||||
G.api.nvim_command(cmd)
|
||||
end
|
||||
|
||||
function G.exec(c)
|
||||
G.api.nvim_exec(c)
|
||||
end
|
||||
|
||||
function G.eval(c)
|
||||
return G.api.nvim_eval(c)
|
||||
end
|
||||
|
||||
return G
|
|
@ -7,7 +7,7 @@ local noreopt = { noremap = true, silent = true }
|
|||
-- save
|
||||
map.set({ "n", "i" }, "<C-s>", "<cmd>w<cr>", noreopt)
|
||||
-- format
|
||||
map.set({ "n", "i" }, "=", "<cmd>lua vim.lsp.buf.format()<cr>", noreopt)
|
||||
map.set({ "n", "v", "x" }, "=", "<cmd>lua vim.lsp.buf.format()<cr>", noreopt)
|
||||
-- fine cmdline
|
||||
map.set("n", ":", "<cmd>FineCmdline<CR>", noreopt)
|
||||
-- telescope
|
||||
|
@ -30,7 +30,10 @@ map.set("n", "<C-l>", "<C-w>l", noreopt)
|
|||
-- 分屏
|
||||
map.set("n", "<leader>sv", ":vsp<CR>", noreopt)
|
||||
map.set("n", "<leader>sh", ":sp<CR>", noreopt)
|
||||
-- 代码块移动
|
||||
-- 代码块选择和移动
|
||||
map.set({"n", "v"}, "L", "$", noreopt) -- 快速行尾
|
||||
map.set({"n", "v"}, "H", "^", noreopt) -- 快速行首
|
||||
map.set({"n", "v", "i"}, "<C-a>", "gg<S-v>G", noreopt) -- 全选
|
||||
map.set("n", "<A-j>", "<Esc>:m .+1<CR>==gi", noreopt)
|
||||
map.set("n", "<A-k>", "<Esc>:m .-2<CR>==gi", noreopt)
|
||||
map.set("v", "<", "<gv", noreopt)
|
||||
|
@ -73,81 +76,81 @@ map.set("n", "#", "#:Beacon<CR>", noreopt)
|
|||
map.set("n", "<leader>mp", ":MarkdownPreviewToggle<CR>", noreopt)
|
||||
-- lspsage
|
||||
function _G.set_lspsage_keymaps()
|
||||
local keymap = vim.keymap.set
|
||||
keymap("n", "cf", "<cmd>Lspsaga lsp_finder<CR>")
|
||||
local keymap = vim.keymap.set
|
||||
keymap("n", "cf", "<cmd>Lspsaga lsp_finder<CR>")
|
||||
|
||||
-- Code action
|
||||
keymap({ "n", "v" }, "ca", "<cmd>Lspsaga code_action<CR>")
|
||||
-- Code action
|
||||
keymap({ "n", "v" }, "ca", "<cmd>Lspsaga code_action<CR>")
|
||||
|
||||
-- Rename all occurrences of the hovered word for the entire file
|
||||
keymap("n", "rn", "<cmd>Lspsaga rename<CR>")
|
||||
-- Rename all occurrences of the hovered word for the entire file
|
||||
keymap("n", "rn", "<cmd>Lspsaga rename<CR>")
|
||||
|
||||
-- Rename all occurrences of the hovered word for the selected files
|
||||
keymap("n", "<leader>rn", "<cmd>Lspsaga rename ++project<CR>")
|
||||
-- Rename all occurrences of the hovered word for the selected files
|
||||
keymap("n", "<leader>rn", "<cmd>Lspsaga rename ++project<CR>")
|
||||
|
||||
-- Peek definition
|
||||
-- You can edit the file containing the definition in the floating window
|
||||
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
|
||||
-- It also supports tagstack
|
||||
-- Use <C-t> to jump back
|
||||
keymap("n", "gd", "<cmd>Lspsaga peek_definition<CR>")
|
||||
-- Peek definition
|
||||
-- You can edit the file containing the definition in the floating window
|
||||
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
|
||||
-- It also supports tagstack
|
||||
-- Use <C-t> to jump back
|
||||
keymap("n", "gd", "<cmd>Lspsaga peek_definition<CR>")
|
||||
|
||||
-- Peek type definition
|
||||
-- You can edit the file containing the type definition in the floating window
|
||||
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
|
||||
-- It also supports tagstack
|
||||
-- Use <C-t> to jump back
|
||||
keymap("n", "gt", "<cmd>Lspsaga peek_type_definition<CR>")
|
||||
-- Peek type definition
|
||||
-- You can edit the file containing the type definition in the floating window
|
||||
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
|
||||
-- It also supports tagstack
|
||||
-- Use <C-t> to jump back
|
||||
keymap("n", "gt", "<cmd>Lspsaga peek_type_definition<CR>")
|
||||
|
||||
-- Show line diagnostics
|
||||
-- You can pass argument ++unfocus to
|
||||
-- unfocus the show_line_diagnostics floating window
|
||||
keymap("n", "<leader>sl", "<cmd>Lspsaga show_line_diagnostics<CR>")
|
||||
-- Show line diagnostics
|
||||
-- You can pass argument ++unfocus to
|
||||
-- unfocus the show_line_diagnostics floating window
|
||||
keymap("n", "<leader>sl", "<cmd>Lspsaga show_line_diagnostics<CR>")
|
||||
|
||||
-- Show cursor diagnostics
|
||||
-- Like show_line_diagnostics, it supports passing the ++unfocus argument
|
||||
keymap("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>")
|
||||
-- Show cursor diagnostics
|
||||
-- Like show_line_diagnostics, it supports passing the ++unfocus argument
|
||||
keymap("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>")
|
||||
|
||||
-- Show buffer diagnostics
|
||||
keymap("n", "<leader>sb", "<cmd>Lspsaga show_buf_diagnostics<CR>")
|
||||
-- Show buffer diagnostics
|
||||
keymap("n", "<leader>sb", "<cmd>Lspsaga show_buf_diagnostics<CR>")
|
||||
|
||||
-- Diagnostic jump
|
||||
-- You can use <C-o> to jump back to your previous location
|
||||
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
||||
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
||||
-- Diagnostic jump
|
||||
-- You can use <C-o> to jump back to your previous location
|
||||
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
||||
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
||||
|
||||
-- Diagnostic jump with filters such as only jumping to an error
|
||||
keymap("n", "[E", function()
|
||||
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
|
||||
end)
|
||||
keymap("n", "]E", function()
|
||||
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
|
||||
end)
|
||||
-- Diagnostic jump with filters such as only jumping to an error
|
||||
keymap("n", "[E", function()
|
||||
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
|
||||
end)
|
||||
keymap("n", "]E", function()
|
||||
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
|
||||
end)
|
||||
|
||||
-- Toggle outline
|
||||
keymap("n", "<leader>o", "<cmd>Lspsaga outline<CR>")
|
||||
-- Toggle outline
|
||||
keymap("n", "<leader>o", "<cmd>Lspsaga outline<CR>")
|
||||
|
||||
-- Hover Doc
|
||||
-- If there is no hover doc,
|
||||
-- there will be a notification stating that
|
||||
-- there is no information available.
|
||||
-- To disable it just use ":Lspsaga hover_doc ++quiet"
|
||||
-- Pressing the key twice will enter the hover window
|
||||
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>")
|
||||
-- Hover Doc
|
||||
-- If there is no hover doc,
|
||||
-- there will be a notification stating that
|
||||
-- there is no information available.
|
||||
-- To disable it just use ":Lspsaga hover_doc ++quiet"
|
||||
-- Pressing the key twice will enter the hover window
|
||||
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>")
|
||||
|
||||
-- If you want to keep the hover window in the top right hand corner,
|
||||
-- you can pass the ++keep argument
|
||||
-- Note that if you use hover with ++keep, pressing this key again will
|
||||
-- close the hover window. If you want to jump to the hover window
|
||||
-- you should use the wincmd command "<C-w>w"
|
||||
keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")
|
||||
-- If you want to keep the hover window in the top right hand corner,
|
||||
-- you can pass the ++keep argument
|
||||
-- Note that if you use hover with ++keep, pressing this key again will
|
||||
-- close the hover window. If you want to jump to the hover window
|
||||
-- you should use the wincmd command "<C-w>w"
|
||||
-- keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")
|
||||
|
||||
-- Call hierarchy
|
||||
keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
|
||||
keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")
|
||||
-- Call hierarchy
|
||||
keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
|
||||
keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")
|
||||
|
||||
-- Floating terminal
|
||||
keymap({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")
|
||||
-- Floating terminal
|
||||
keymap({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")
|
||||
end
|
||||
|
||||
vim.cmd("lua set_lspsage_keymaps()")
|
||||
|
|
|
@ -73,7 +73,6 @@ vim.opt.backup = false
|
|||
vim.opt.swapfile = false
|
||||
vim.opt.writebackup = false
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
-- 开启 Folding
|
||||
vim.wo.foldmethod = "expr"
|
||||
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
local lsp_status = require("lsp-status")
|
||||
lsp_status.register_progress()
|
||||
lsp_status.config({
|
||||
indicator_errors = "❌",
|
||||
indicator_warnings = "⚠️ ",
|
||||
indicator_info = "ℹ️ ",
|
||||
-- https://emojipedia.org/tips/
|
||||
indicator_hint = "💡",
|
||||
indicator_ok = "✅",
|
||||
})
|
||||
|
||||
require("lspconfig").clangd.setup({
|
||||
handlers = lsp_status.extensions.clangd.setup(),
|
||||
init_options = {
|
||||
clangdFileStatus = true,
|
||||
},
|
||||
capabilities = lsp_status.capabilities,
|
||||
})
|
107
lua/lsp/go.lua
107
lua/lsp/go.lua
|
@ -1,69 +1,74 @@
|
|||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local feedkey = function(key, mode)
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
||||
end
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" }, -- For vsnip users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" }, -- For vsnip users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities() --nvim-cmp
|
||||
|
||||
require("lspconfig")["golangci_lint_ls"].setup({
|
||||
on_attach = common_lsp_on_attach,
|
||||
flags = common_lsp_flags,
|
||||
on_attach = common_lsp_on_attach,
|
||||
flags = common_lsp_flags,
|
||||
})
|
||||
|
||||
util = require("lspconfig/util")
|
||||
require("lspconfig")["gopls"].setup({
|
||||
cmd = { "gopls" },
|
||||
on_attach = common_lsp_on_attach,
|
||||
flags = common_lsp_flags,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
gopls = {
|
||||
experimentalPostfixCompletions = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
shadow = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
init_options = { usePlaceholders = true },
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod" },
|
||||
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
||||
on_attach = common_lsp_on_attach,
|
||||
flags = common_lsp_flags,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
gopls = {
|
||||
experimentalPostfixCompletions = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
shadow = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
init_options = { usePlaceholders = true },
|
||||
})
|
||||
|
||||
|
|
|
@ -3,9 +3,14 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
require("lspconfig").jsonls.setup({
|
||||
capabilities = capabilities,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").taplo.setup({})
|
||||
|
||||
require("lspconfig").yamlls.setup({})
|
||||
|
||||
require("lspconfig").bufls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = common_lsp_on_attach,
|
||||
})
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
require("auto-save").setup({
|
||||
trigger_events = { "InsertLeave", "BufLeave", "BufWinLeave" },
|
||||
})
|
||||
require("nvim-autopairs").setup({})
|
||||
require("nvim-ts-autotag").setup({})
|
||||
require("unimpaired").setup({})
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
|
@ -1,3 +0,0 @@
|
|||
require("auto-save").setup {
|
||||
trigger_events = {"InsertLeave", "BufLeave", "BufWinLeave"},
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
require("dapui").setup()
|
||||
require("nvim-dap-virtual-text").setup()
|
||||
-- IMPORTANT: make sure to setup neodev BEFORE lspconfig
|
||||
require("neodev").setup({
|
||||
-- add any options here, or leave empty to use the default settings
|
||||
library = { plugins = { "nvim-dap-ui" }, types = true },
|
||||
})
|
|
@ -7,36 +7,41 @@ vim.opt.termguicolors = true
|
|||
|
||||
-- OR setup with some options
|
||||
require("nvim-tree").setup({
|
||||
sort_by = "case_sensitive",
|
||||
view = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = "u", action = "dir_up" },
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
},
|
||||
})
|
||||
auto_reload_on_write = true,
|
||||
sort_by = "case_sensitive",
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = true,
|
||||
},
|
||||
filters = { custom = { ".git" } },
|
||||
view = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = "u", action = "dir_up" },
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
})
|
||||
|
||||
local function open_nvim_tree(data)
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
vim.cmd.cd(data.file)
|
||||
-- change to the directory
|
||||
vim.cmd.cd(data.file)
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
-- 快捷键提示
|
||||
require("which-key").setup({})
|
||||
-- 自定义快捷键
|
||||
require("legendary").setup({
|
||||
which_key = { auto_register = true },
|
||||
extensions = {
|
||||
-- load keymaps and commands from nvim-tree.lua
|
||||
},
|
||||
})
|
|
@ -1 +0,0 @@
|
|||
require("numbers").setup({})
|
|
@ -1,13 +1,15 @@
|
|||
require("lspsaga").setup({
|
||||
ui = {
|
||||
colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(),
|
||||
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
|
||||
},
|
||||
ui = {
|
||||
colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(),
|
||||
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
|
||||
},
|
||||
})
|
||||
|
||||
require("lsp-colors").setup({
|
||||
Error = "#db4b4b",
|
||||
Warning = "#e0af68",
|
||||
Information = "#0db9d7",
|
||||
Hint = "#10B981"
|
||||
Error = "#db4b4b",
|
||||
Warning = "#e0af68",
|
||||
Information = "#0db9d7",
|
||||
Hint = "#10B981",
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -1,40 +1,47 @@
|
|||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "tokyonight",
|
||||
component_separators = { left = "|", right = "|" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "tokyonight",
|
||||
component_separators = { left = "|", right = "|" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename", "lsp_progress" },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {},
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
|
|
|
@ -1,33 +1,38 @@
|
|||
require("mason").setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
"golangci_lint_ls",
|
||||
"tsserver",
|
||||
"volar",
|
||||
"taplo",
|
||||
"lemminx",
|
||||
"yamlls",
|
||||
"sqlls",
|
||||
"jsonls",
|
||||
"jdtls",
|
||||
"bashls",
|
||||
"cssls",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
"eslint",
|
||||
"html",
|
||||
},
|
||||
automatic_installation = true,
|
||||
ensure_installed = {
|
||||
"clangd",
|
||||
"emmet_ls",
|
||||
"cmake",
|
||||
"gradle_ls",
|
||||
"kotlin_language_server",
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
"golangci_lint_ls",
|
||||
"tsserver",
|
||||
"volar",
|
||||
"taplo",
|
||||
"yamlls",
|
||||
"jsonls",
|
||||
"jdtls",
|
||||
"bashls",
|
||||
"cssls",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
"eslint",
|
||||
"html",
|
||||
"bufls",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
|
|
|
@ -3,41 +3,9 @@ local null_ls = require("null-ls")
|
|||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.buf,
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
null_ls.builtins.formatting.dart_format,
|
||||
null_ls.builtins.formatting.eslint_d,
|
||||
null_ls.builtins.formatting.fixjson,
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
null_ls.builtins.formatting.goimports_reviser,
|
||||
null_ls.builtins.formatting.google_java_format,
|
||||
null_ls.builtins.formatting.markdownlint,
|
||||
null_ls.builtins.formatting.markdown_toc,
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.formatting.taplo,
|
||||
null_ls.builtins.formatting.xmllint,
|
||||
null_ls.builtins.formatting.yamlfmt,
|
||||
null_ls.builtins.formatting.eslint_d,
|
||||
-- 诊断
|
||||
null_ls.builtins.diagnostics.buf,
|
||||
null_ls.builtins.diagnostics.checkmake,
|
||||
null_ls.builtins.diagnostics.checkstyle,
|
||||
null_ls.builtins.diagnostics.clang_check,
|
||||
null_ls.builtins.diagnostics.cppcheck,
|
||||
null_ls.builtins.diagnostics.eslint_d,
|
||||
null_ls.builtins.diagnostics.gitlint,
|
||||
null_ls.builtins.diagnostics.golangci_lint,
|
||||
null_ls.builtins.diagnostics.jsonlint,
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
null_ls.builtins.diagnostics.yamllint,
|
||||
-- 动作
|
||||
null_ls.builtins.code_actions.eslint_d,
|
||||
null_ls.builtins.code_actions.gitrebase,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.code_actions.gomodifytags,
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
null_ls.builtins.code_actions.xo,
|
||||
-- 完成
|
||||
null_ls.builtins.completion.luasnip,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
-- url罗列
|
||||
require("urlview").setup({})
|
||||
-- 行号模式切换
|
||||
require("numbers").setup({})
|
||||
-- 终端管理
|
||||
require("toggleterm").setup({})
|
||||
-- 错误列表
|
||||
require("trouble").setup({})
|
||||
-- ui配置
|
||||
require('dressing').setup({})
|
|
@ -1 +1,47 @@
|
|||
require("telescope").setup({})
|
||||
-- 模糊搜索
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
local themes = require("telescope.themes")
|
||||
telescope.setup({
|
||||
defaults = themes.get_dropdown({
|
||||
path_display = { "absolute" },
|
||||
file_ignore_patterns = { ".git/", "node_modules" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<Down>"] = actions.cycle_history_next,
|
||||
["<Up>"] = actions.cycle_history_prev,
|
||||
["<C-n>"] = actions.cycle_history_next,
|
||||
["<C-p>"] = actions.cycle_history_prev,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
},
|
||||
},
|
||||
}),
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
},
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({
|
||||
-- even more opts
|
||||
}),
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
no_ignore = true,
|
||||
no_ignore_parent = true,
|
||||
},
|
||||
buffers = {
|
||||
sort_mru = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("ui-select")
|
||||
telescope.load_extension("fzf")
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
require("toggleterm").setup({})
|
|
@ -28,6 +28,7 @@ require("nvim-treesitter.configs").setup({
|
|||
"vim",
|
||||
"vue",
|
||||
"yaml",
|
||||
"proto",
|
||||
},
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = true,
|
||||
|
@ -39,15 +40,15 @@ require("nvim-treesitter.configs").setup({
|
|||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
node_decremental = "<BS>",
|
||||
scope_incremental = "<TAB>",
|
||||
},
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
node_decremental = "<BS>",
|
||||
scope_incremental = "<TAB>",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
require("trouble").setup({})
|
|
@ -0,0 +1,52 @@
|
|||
local G = require("core.g")
|
||||
|
||||
local wilder = require("wilder")
|
||||
wilder.setup({
|
||||
modes = { ":", "/", "?" },
|
||||
next_key = 0,
|
||||
previous_key = 0,
|
||||
reject_key = 0,
|
||||
accept_key = 0,
|
||||
})
|
||||
wilder.set_option("pipeline", {
|
||||
wilder.branch(
|
||||
{
|
||||
wilder.check(function(_, x)
|
||||
return G.fn.empty(x)
|
||||
end),
|
||||
wilder.history(15),
|
||||
},
|
||||
wilder.cmdline_pipeline({
|
||||
fuzzy = 1,
|
||||
fuzzy_filter = wilder.vim_fuzzy_filter(),
|
||||
}),
|
||||
wilder.search_pipeline()
|
||||
),
|
||||
wilder.debounce(10),
|
||||
})
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.popupmenu_renderer(wilder.popupmenu_border_theme({
|
||||
highlights = {
|
||||
accent = "WilderAccent",
|
||||
selected_accent = "WilderSelectedAccent",
|
||||
},
|
||||
highlighter = wilder.basic_highlighter(),
|
||||
left = { " ", wilder.popupmenu_devicons() },
|
||||
right = { " ", wilder.popupmenu_scrollbar() },
|
||||
border = "rounded",
|
||||
max_height = 17, -- 最大高度限制 因为要计算上下 所以17支持最多15个选项
|
||||
}))
|
||||
)
|
||||
G.cmd("silent! UpdateRemotePlugins")
|
||||
G.hi({
|
||||
WilderAccent = { fg = 12 },
|
||||
WilderSelectedAccent = { fg = 12, bg = 239 },
|
||||
})
|
||||
G.map({
|
||||
{ "c", "<tab>", [[wilder#in_context() ? wilder#next() : '<tab>']], { noremap = true, expr = true } },
|
||||
{ "c", "<Down>", [[wilder#in_context() ? wilder#next() : '<down>']], { noremap = true, expr = true } },
|
||||
{ "c", "<up>", [[wilder#in_context() ? wilder#previous() : '<up>']], { noremap = true, expr = true } },
|
||||
{ "c", "0", "0", {} }, -- 不清楚原因导致0无法使用 强制覆盖
|
||||
})
|
||||
|
343
lua/setup.lua
343
lua/setup.lua
|
@ -12,145 +12,210 @@ end
|
|||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
use({ "wbthomason/packer.nvim" })
|
||||
use({ "folke/tokyonight.nvim" })
|
||||
use({ "catppuccin/nvim", as = "catppuccin" })
|
||||
use({
|
||||
"https://github.com/lewis6991/impatient.nvim",
|
||||
config = function()
|
||||
require("impatient")
|
||||
end,
|
||||
})
|
||||
use({ "wbthomason/packer.nvim" })
|
||||
use({ "folke/tokyonight.nvim" })
|
||||
use({ "stevearc/dressing.nvim" })
|
||||
use({ "catppuccin/nvim", as = "catppuccin" })
|
||||
|
||||
-- bufferline
|
||||
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
|
||||
-- 行号模式自动切换
|
||||
use({ "nkakouros-original/numbers.nvim" })
|
||||
-- 模糊搜索
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.1",
|
||||
requires = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
{ "kdheepak/lazygit.nvim" },
|
||||
},
|
||||
})
|
||||
-- 文件树
|
||||
use({
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons", -- optional, for file icons
|
||||
},
|
||||
tag = "nightly", -- optional, updated every week. (see issue #1193)
|
||||
})
|
||||
-- 终端管理
|
||||
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
||||
-- LSP管理器
|
||||
use({
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
})
|
||||
-- 命令行
|
||||
use({
|
||||
"VonHeikemen/fine-cmdline.nvim",
|
||||
requires = {
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
},
|
||||
})
|
||||
-- 通知
|
||||
use({ "rcarriga/nvim-notify" })
|
||||
|
||||
-- 缩进线
|
||||
use({ "lukas-reineke/indent-blankline.nvim" })
|
||||
-- 注释管理
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup({})
|
||||
end,
|
||||
})
|
||||
-- git管理
|
||||
use({ "lewis6991/gitsigns.nvim" })
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
})
|
||||
use({
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({})
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"Pocco81/auto-save.nvim",
|
||||
})
|
||||
use({
|
||||
"glepnir/lspsaga.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
--Please make sure you install markdown and markdown_inline parser
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"folke/lsp-colors.nvim",
|
||||
},
|
||||
})
|
||||
-- 错误列表
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
requires = "nvim-tree/nvim-web-devicons",
|
||||
})
|
||||
-- 上下高亮跳动
|
||||
use({ "danilamihailov/beacon.nvim" })
|
||||
-- markdown lsp
|
||||
use({
|
||||
"iamcco/markdown-preview.nvim",
|
||||
run = "cd app && npm install",
|
||||
setup = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
})
|
||||
-- 跳转
|
||||
use({ "ggandor/leap.nvim" })
|
||||
use({ "ggandor/flit.nvim" })
|
||||
-- 项目管理
|
||||
use({ "ahmedkhalf/project.nvim" })
|
||||
-- 优化启动速度
|
||||
use({ "lewis6991/impatient.nvim" })
|
||||
-- TODO 管理
|
||||
use({
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
})
|
||||
-- 代码高亮
|
||||
use({
|
||||
-- bufferline
|
||||
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
|
||||
-- 行号模式自动切换
|
||||
use({ "nkakouros-original/numbers.nvim" })
|
||||
-- 文件树
|
||||
use({
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons", -- optional, for file icons
|
||||
},
|
||||
tag = "nightly", -- optional, updated every week. (see issue #1193)
|
||||
})
|
||||
-- 终端管理
|
||||
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
||||
-- LSP管理器
|
||||
use({
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
})
|
||||
-- 命令行
|
||||
use({
|
||||
"VonHeikemen/fine-cmdline.nvim",
|
||||
requires = {
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
},
|
||||
})
|
||||
-- 通知
|
||||
use({ "rcarriga/nvim-notify" })
|
||||
-- 缩进线
|
||||
use({ "lukas-reineke/indent-blankline.nvim" })
|
||||
-- 注释管理
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup({})
|
||||
end,
|
||||
})
|
||||
-- git管理
|
||||
use({ "lewis6991/gitsigns.nvim" })
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
})
|
||||
-- 自动修复部分按键
|
||||
use({ "tummetott/unimpaired.nvim" })
|
||||
-- 标签补全
|
||||
use({ "windwp/nvim-autopairs" })
|
||||
use({ "windwp/nvim-ts-autotag" })
|
||||
-- 自动保存
|
||||
use({
|
||||
"Pocco81/auto-save.nvim",
|
||||
})
|
||||
-- lspsaga
|
||||
use({
|
||||
"glepnir/lspsaga.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
--Please make sure you install markdown and markdown_inline parser
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
})
|
||||
-- 自动完成相关
|
||||
use({
|
||||
"folke/lsp-colors.nvim",
|
||||
},
|
||||
})
|
||||
-- 错误列表
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
requires = "nvim-tree/nvim-web-devicons",
|
||||
})
|
||||
-- 上下高亮跳动
|
||||
use({ "danilamihailov/beacon.nvim" })
|
||||
-- markdown lsp
|
||||
use({ "mzlogin/vim-markdown-toc", ft = "markdown" })
|
||||
use({
|
||||
"iamcco/markdown-preview.nvim",
|
||||
run = "cd app && npm install",
|
||||
setup = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
})
|
||||
-- 跳转
|
||||
use({ "ggandor/leap.nvim" })
|
||||
use({ "ggandor/flit.nvim" })
|
||||
-- 项目管理
|
||||
use({ "ahmedkhalf/project.nvim" })
|
||||
-- TODO 管理
|
||||
use({
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
})
|
||||
-- 代码高亮
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
})
|
||||
use({ "nvim-treesitter/playground", after = "nvim-treesitter" })
|
||||
-- 自动完成相关
|
||||
use({
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"onsails/lspkind-nvim",
|
||||
"octaltree/cmp-look",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"onsails/lspkind-nvim",
|
||||
"octaltree/cmp-look",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
})
|
||||
-- golang ide
|
||||
use({
|
||||
"ray-x/go.nvim",
|
||||
"ray-x/guihua.lua", -- recommended if need floating window support
|
||||
})
|
||||
-- 高亮当前关键词
|
||||
use({ "RRethy/vim-illuminate" })
|
||||
|
||||
-- 自动保存
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
})
|
||||
use({
|
||||
"L3MON4D3/LuaSnip",
|
||||
requires = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
-- follow latest release.
|
||||
tag = "v<CurrentMajor>.*",
|
||||
-- install jsregexp (optional!:).
|
||||
run = "make install_jsregexp",
|
||||
})
|
||||
-- golang ide
|
||||
use({
|
||||
"ray-x/go.nvim",
|
||||
"ray-x/guihua.lua", -- recommended if need floating window support
|
||||
})
|
||||
-- 高亮当前关键词
|
||||
use({ "RRethy/vim-illuminate" })
|
||||
-- 罗列文件中的所有url
|
||||
use("axieax/urlview.nvim")
|
||||
-- 快捷键提示
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
})
|
||||
-- debug
|
||||
use({
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"mfussenegger/nvim-dap",
|
||||
"folke/neodev.nvim",
|
||||
})
|
||||
-- 命令模式增强
|
||||
use({
|
||||
"gelguy/wilder.nvim",
|
||||
config = function()
|
||||
-- config goes here
|
||||
end,
|
||||
})
|
||||
-- lsp 状态
|
||||
use("nvim-lua/lsp-status.nvim")
|
||||
-- 屏幕保护
|
||||
use("eandrju/cellular-automaton.nvim")
|
||||
-- LSP 进度同步
|
||||
use({
|
||||
"https://github.com/j-hui/fidget.nvim",
|
||||
config = function()
|
||||
require("fidget").setup({
|
||||
text = {
|
||||
spinner = "dots",
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
-- 模糊搜索
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.1",
|
||||
requires = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
{ "kdheepak/lazygit.nvim" },
|
||||
},
|
||||
})
|
||||
use({
|
||||
"https://github.com/nvim-telescope/telescope-fzf-native.nvim",
|
||||
run = "make",
|
||||
})
|
||||
use({ "nvim-telescope/telescope-ui-select.nvim" })
|
||||
-- 自定义命令
|
||||
use({
|
||||
"mrjones2014/legendary.nvim",
|
||||
requires = "kkharji/sqlite.lua",
|
||||
})
|
||||
-- 自动保存
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue