fix: golang lsp action

This commit is contained in:
Young Xu 2023-02-26 21:29:03 +08:00
parent 842191f4d0
commit 1f3896974d
Signed by: xuthus5
GPG Key ID: A23CF9620CBB55F9
38 changed files with 877 additions and 456 deletions

View File

@ -19,6 +19,8 @@ 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
go install github.com/yoheimuta/protolint/cmd/protolint@latest
```
### 记忆项

1
ftplugin/javascript.vim Normal file
View File

@ -0,0 +1 @@
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>

51
ftplugin/markdown.vim Normal file
View File

@ -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

1
ftplugin/mysql.vim Normal file
View File

@ -0,0 +1 @@
let g:omni_sql_no_default_maps = 1

105
ftplugin/proto.vim Normal file
View File

@ -0,0 +1,105 @@
" Protocol Buffers - Google's data interchange format
" Copyright 2008 Google Inc. All rights reserved.
" https://developers.google.com/protocol-buffers/
"
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions are
" met:
"
" * Redistributions of source code must retain the above copyright
" notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the following disclaimer
" in the documentation and/or other materials provided with the
" distribution.
" * Neither the name of Google Inc. nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" This is the Vim syntax file for Google Protocol Buffers.
"
" Usage:
"
" 1. cp proto.vim ~/.vim/syntax/
" 2. Add the following to ~/.vimrc:
"
" augroup filetype
" au! BufRead,BufNewFile *.proto setfiletype proto
" augroup end
"
" Or just create a new file called ~/.vim/ftdetect/proto.vim with the
" previous lines on it.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
syn keyword pbTodo contained TODO FIXME XXX
syn cluster pbCommentGrp contains=pbTodo
syn keyword pbSyntax syntax import option
syn keyword pbStructure package message group oneof
syn keyword pbRepeat optional required repeated
syn keyword pbDefault default
syn keyword pbExtend extend extensions to max reserved
syn keyword pbRPC service rpc returns
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
syn keyword pbType float double bool string bytes
syn keyword pbTypedef enum
syn keyword pbBool true false
syn match pbInt /-\?\<\d\+\>/
syn match pbInt /\<0[xX]\x+\>/
syn match pbFloat /\<-\?\d*\(\.\d*\)\?/
syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp,@Spell
syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp,@Spell
syn region pbString start=/"/ skip=/\\./ end=/"/ contains=@Spell
syn region pbString start=/'/ skip=/\\./ end=/'/ contains=@Spell
if version >= 508 || !exists("did_proto_syn_inits")
if version < 508
let did_proto_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink pbTodo Todo
HiLink pbSyntax Include
HiLink pbStructure Structure
HiLink pbRepeat Repeat
HiLink pbDefault Keyword
HiLink pbExtend Keyword
HiLink pbRPC Keyword
HiLink pbType Type
HiLink pbTypedef Typedef
HiLink pbBool Boolean
HiLink pbInt Number
HiLink pbFloat Float
HiLink pbComment Comment
HiLink pbString String
delcommand HiLink
endif
let b:current_syntax = "proto"

1
ftplugin/python.vim Normal file
View File

@ -0,0 +1 @@
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>

1
ftplugin/sql.vim Normal file
View File

@ -0,0 +1 @@
let g:omni_sql_no_default_maps = 1

1
ftplugin/typescript.vim Normal file
View File

@ -0,0 +1 @@
vnoremap <silent><buffer> D :<c-u>call SurroundVaddPairs("/** ", " */")<cr>

4
ftplugin/vue.vim Normal file
View File

@ -0,0 +1,4 @@
augroup vue
au!
autocmd BufWritePre *.vue :call CocAction('format')
augroup END

View File

@ -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")

52
lua/core/g.lua Normal file
View File

@ -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

View File

@ -7,15 +7,15 @@ 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
map.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore
map.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>") -- find string in current working directory as you type
map.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>") -- find string under cursor in current working directory
map.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>") -- list open buffers in current neovim instance
map.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>") -- list available help tags
map.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore
map.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>") -- find string in current working directory as you type
map.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>") -- find string under cursor in current working directory
map.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>") -- list open buffers in current neovim instance
map.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>") -- list available help tags
map.set("n", "<leader>lds", "<cmd>Telescope lsp_document_symbols<cr>") -- list all functions/structs/classes/modules in the current buffer
-- 重置窗口大小
map.set("n", "<C-Up>", ":resize -2<CR>", noreopt)
@ -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()")

View File

@ -73,11 +73,9 @@ 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()"
-- 默认不要折叠
-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file
vim.wo.foldlevel = 99

View File

@ -1 +1 @@
vim.cmd[[colorscheme tokyonight-storm]]
vim.cmd([[colorscheme tokyonight-storm]])

19
lua/lsp/clang.lua Normal file
View File

@ -0,0 +1,19 @@
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({
filetypes = { "c", "cpp", "objc", "objcpp", "cuda" },
handlers = lsp_status.extensions.clangd.setup(),
init_options = {
clangdFileStatus = true,
},
capabilities = lsp_status.capabilities,
})

View File

@ -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 },
})

View File

@ -3,7 +3,7 @@ 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({})

7
lua/plugins/auto-do.lua Normal file
View File

@ -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()

View File

@ -1,3 +0,0 @@
require("auto-save").setup {
trigger_events = {"InsertLeave", "BufLeave", "BufWinLeave"},
}

View File

@ -1,19 +1,19 @@
require("bufferline").setup({
options = {
options = {
-- 使用 nvim 内置lsp
diagnostics = "nvim_lsp",
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict)
return "("..count..")"
end,
always_show_bufferline = false,
-- 左侧让出 nvim-tree 的位置
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",
highlight = "Directory",
text_align = "left",
},
},
},
return "(" .. count .. ")"
end,
always_show_bufferline = false,
-- 左侧让出 nvim-tree 的位置
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",
highlight = "Directory",
text_align = "left",
},
},
},
})

7
lua/plugins/debug.lua Normal file
View File

@ -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 },
})

View File

@ -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 })

View File

@ -1,9 +1,9 @@
require("go").setup()
local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimport()
end,
group = format_sync_grp,
pattern = "*.go",
callback = function()
require("go.format").goimport()
end,
group = format_sync_grp,
})

View File

@ -3,8 +3,8 @@ vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
require("indent_blankline").setup({
show_current_context = true,
show_current_context_start = true,
show_end_of_line = true,
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
show_end_of_line = true,
space_char_blankline = " ",
})

View File

@ -2,11 +2,11 @@ require("leap").add_default_mappings()
require("leap").opts.highlight_unlabeled_phase_one_targets = true
require("flit").setup({
keys = { f = "f", F = "F", t = "t", T = "T" },
-- A string like "nv", "nvo", "o", etc.
labeled_modes = "v",
multiline = true,
-- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} }
opts = {},
keys = { f = "f", F = "F", t = "t", T = "T" },
-- A string like "nv", "nvo", "o", etc.
labeled_modes = "v",
multiline = true,
-- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} }
opts = {},
})

View File

@ -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
},
})

View File

@ -1 +0,0 @@
require("numbers").setup({})

View File

@ -1,13 +1,13 @@
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",
})

View File

@ -1,40 +1,40 @@
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" },
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 = {},
})

View File

@ -1,33 +1,36 @@
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",
},
automatic_installation = true,
})

View File

@ -1,43 +1,13 @@
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,
sources = {
null_ls.builtins.formatting.stylua,
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.formatting.protolint,
-- 诊断
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,
},
null_ls.builtins.diagnostics.protolint,
},
})

12
lua/plugins/peaceful.lua Normal file
View File

@ -0,0 +1,12 @@
-- url罗列
require("urlview").setup({})
-- 行号模式切换
require("numbers").setup({})
-- 终端管理
require("toggleterm").setup({})
-- 错误列表
require("trouble").setup({})
-- ui配置
require("dressing").setup({})
-- lsp状态
require("fidget").setup({})

View File

@ -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")

View File

@ -1 +0,0 @@
require("toggleterm").setup({})

View File

@ -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,
},

View File

@ -1 +0,0 @@
require("trouble").setup({})

52
lua/plugins/wilder.lua Normal file
View File

@ -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无法使用 强制覆盖
})

View File

@ -12,145 +12,212 @@ 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",
})
-- protobuf 识别
use("wfxr/protobuf.vim")
-- 自动保存
if packer_bootstrap then
require("packer").sync()
end
end)