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 eslint --global
npm install -g typescript typescript-language-server npm install -g typescript typescript-language-server
npm install -g @volar/vue-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("setup")
require("core.g")
require("core.option") require("core.option")
-- 加载插件配置文件 -- 加载插件配置文件
-- 文件树 -- 文件树
require("plugins.file-tree") require("plugins.file-tree")
-- 行号模式切换 -- 默认配置
require("plugins.line-numbers") require("plugins.peaceful")
-- 模糊搜索 -- debug 配置
require("plugins.telescope") require("plugins.debug")
-- mason管理 -- mason管理
require("plugins.mason") require("plugins.mason")
-- 终端管理
require("plugins.terminal")
-- bufferline -- bufferline
require("plugins.bufferline") require("plugins.bufferline")
-- 空白缩进 -- 空白缩进
@ -20,23 +18,24 @@ require("plugins.indent_blackline")
-- 底部状态 -- 底部状态
require("plugins.lualine") require("plugins.lualine")
-- 自动保存 -- 自动保存
require("plugins.auto-save") require("plugins.auto-do")
-- 通知 -- 通知
require("plugins.notify") require("plugins.notify")
-- 格式化 -- 格式化
require("plugins.null-ls") require("plugins.null-ls")
-- 错误列表
require("plugins.trouble")
-- git -- git
require("plugins.gitsigns") require("plugins.gitsigns")
-- 文件搜索
require("plugins.telescope")
-- 快速跳转 -- 快速跳转
require("plugins.leap") require("plugins.leap")
-- 代码高亮配置 -- 代码高亮配置
require("plugins.treesitter") require("plugins.treesitter")
-- lspsaga -- wilder配置
require("plugins.lspsaga") require("plugins.wilder")
-- golang lsp -- 自定义快捷键配置
require("plugins.golang") require("plugins.legendary")
-- lsp 配置
require("lsp.init") require("lsp.init")
require("lsp.bash") require("lsp.bash")
require("lsp.docker") require("lsp.docker")
@ -45,6 +44,11 @@ require("lsp.go")
require("lsp.lua") require("lsp.lua")
require("lsp.protocol") require("lsp.protocol")
require("lsp.volar") require("lsp.volar")
require("lsp.clang")
-- lspsaga
require("plugins.lspsaga")
-- golang lsp
require("plugins.golang")
-- 载入主题 -- 载入主题
require("core.theme") 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 -- save
map.set({ "n", "i" }, "<C-s>", "<cmd>w<cr>", noreopt) map.set({ "n", "i" }, "<C-s>", "<cmd>w<cr>", noreopt)
-- format -- 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 -- fine cmdline
map.set("n", ":", "<cmd>FineCmdline<CR>", noreopt) map.set("n", ":", "<cmd>FineCmdline<CR>", noreopt)
-- telescope -- telescope
map.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore 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>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>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>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>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", "<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) 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>sv", ":vsp<CR>", noreopt)
map.set("n", "<leader>sh", ":sp<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-j>", "<Esc>:m .+1<CR>==gi", noreopt)
map.set("n", "<A-k>", "<Esc>:m .-2<CR>==gi", noreopt) map.set("n", "<A-k>", "<Esc>:m .-2<CR>==gi", noreopt)
map.set("v", "<", "<gv", noreopt) map.set("v", "<", "<gv", noreopt)
@ -73,81 +76,81 @@ map.set("n", "#", "#:Beacon<CR>", noreopt)
map.set("n", "<leader>mp", ":MarkdownPreviewToggle<CR>", noreopt) map.set("n", "<leader>mp", ":MarkdownPreviewToggle<CR>", noreopt)
-- lspsage -- lspsage
function _G.set_lspsage_keymaps() function _G.set_lspsage_keymaps()
local keymap = vim.keymap.set local keymap = vim.keymap.set
keymap("n", "cf", "<cmd>Lspsaga lsp_finder<CR>") keymap("n", "cf", "<cmd>Lspsaga lsp_finder<CR>")
-- Code action -- Code action
keymap({ "n", "v" }, "ca", "<cmd>Lspsaga code_action<CR>") keymap({ "n", "v" }, "ca", "<cmd>Lspsaga code_action<CR>")
-- Rename all occurrences of the hovered word for the entire file -- Rename all occurrences of the hovered word for the entire file
keymap("n", "rn", "<cmd>Lspsaga rename<CR>") keymap("n", "rn", "<cmd>Lspsaga rename<CR>")
-- Rename all occurrences of the hovered word for the selected files -- Rename all occurrences of the hovered word for the selected files
keymap("n", "<leader>rn", "<cmd>Lspsaga rename ++project<CR>") keymap("n", "<leader>rn", "<cmd>Lspsaga rename ++project<CR>")
-- Peek definition -- Peek definition
-- You can edit the file containing the definition in the floating window -- 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 open/vsplit/etc operations, do refer to "definition_action_keys"
-- It also supports tagstack -- It also supports tagstack
-- Use <C-t> to jump back -- Use <C-t> to jump back
keymap("n", "gd", "<cmd>Lspsaga peek_definition<CR>") keymap("n", "gd", "<cmd>Lspsaga peek_definition<CR>")
-- Peek type definition -- Peek type definition
-- You can edit the file containing the type definition in the floating window -- 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 open/vsplit/etc operations, do refer to "definition_action_keys"
-- It also supports tagstack -- It also supports tagstack
-- Use <C-t> to jump back -- Use <C-t> to jump back
keymap("n", "gt", "<cmd>Lspsaga peek_type_definition<CR>") keymap("n", "gt", "<cmd>Lspsaga peek_type_definition<CR>")
-- Show line diagnostics -- Show line diagnostics
-- You can pass argument ++unfocus to -- You can pass argument ++unfocus to
-- unfocus the show_line_diagnostics floating window -- unfocus the show_line_diagnostics floating window
keymap("n", "<leader>sl", "<cmd>Lspsaga show_line_diagnostics<CR>") keymap("n", "<leader>sl", "<cmd>Lspsaga show_line_diagnostics<CR>")
-- Show cursor diagnostics -- Show cursor diagnostics
-- Like show_line_diagnostics, it supports passing the ++unfocus argument -- Like show_line_diagnostics, it supports passing the ++unfocus argument
keymap("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>") keymap("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>")
-- Show buffer diagnostics -- Show buffer diagnostics
keymap("n", "<leader>sb", "<cmd>Lspsaga show_buf_diagnostics<CR>") keymap("n", "<leader>sb", "<cmd>Lspsaga show_buf_diagnostics<CR>")
-- Diagnostic jump -- Diagnostic jump
-- You can use <C-o> to jump back to your previous location -- 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_prev<CR>")
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>") keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>")
-- Diagnostic jump with filters such as only jumping to an error -- Diagnostic jump with filters such as only jumping to an error
keymap("n", "[E", function() keymap("n", "[E", function()
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR }) require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
end) end)
keymap("n", "]E", function() keymap("n", "]E", function()
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR }) require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
end) end)
-- Toggle outline -- Toggle outline
keymap("n", "<leader>o", "<cmd>Lspsaga outline<CR>") keymap("n", "<leader>o", "<cmd>Lspsaga outline<CR>")
-- Hover Doc -- Hover Doc
-- If there is no hover doc, -- If there is no hover doc,
-- there will be a notification stating that -- there will be a notification stating that
-- there is no information available. -- there is no information available.
-- To disable it just use ":Lspsaga hover_doc ++quiet" -- To disable it just use ":Lspsaga hover_doc ++quiet"
-- Pressing the key twice will enter the hover window -- Pressing the key twice will enter the hover window
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>") keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>")
-- If you want to keep the hover window in the top right hand corner, -- If you want to keep the hover window in the top right hand corner,
-- you can pass the ++keep argument -- you can pass the ++keep argument
-- Note that if you use hover with ++keep, pressing this key again will -- 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 -- close the hover window. If you want to jump to the hover window
-- you should use the wincmd command "<C-w>w" -- you should use the wincmd command "<C-w>w"
keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>") -- keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")
-- Call hierarchy -- Call hierarchy
keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>") keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>") keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")
-- Floating terminal -- Floating terminal
keymap({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>") keymap({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")
end end
vim.cmd("lua set_lspsage_keymaps()") vim.cmd("lua set_lspsage_keymaps()")

View File

@ -73,11 +73,9 @@ vim.opt.backup = false
vim.opt.swapfile = false vim.opt.swapfile = false
vim.opt.writebackup = false vim.opt.writebackup = false
vim.opt.undofile = true vim.opt.undofile = true
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
-- 开启 Folding -- 开启 Folding
vim.wo.foldmethod = "expr" vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()" vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
-- 默认不要折叠 -- 默认不要折叠
-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file -- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file
vim.wo.foldlevel = 99 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 has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 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 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
local feedkey = function(key, mode) 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 end
local cmp = require("cmp") local cmp = require("cmp")
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end, end,
}, },
mapping = { mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ["<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) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "") feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
else else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`. fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function() ["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "") feedkey("<Plug>(vsnip-jump-prev)", "")
end end
end, { "i", "s" }), end, { "i", "s" }),
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "vsnip" }, -- For vsnip users. { name = "vsnip" }, -- For vsnip users.
}, { }, {
{ name = "buffer" }, { name = "buffer" },
}), }),
}) })
local capabilities = require("cmp_nvim_lsp").default_capabilities() --nvim-cmp local capabilities = require("cmp_nvim_lsp").default_capabilities() --nvim-cmp
require("lspconfig")["golangci_lint_ls"].setup({ require("lspconfig")["golangci_lint_ls"].setup({
on_attach = common_lsp_on_attach, on_attach = common_lsp_on_attach,
flags = common_lsp_flags, flags = common_lsp_flags,
}) })
util = require("lspconfig/util")
require("lspconfig")["gopls"].setup({ require("lspconfig")["gopls"].setup({
cmd = { "gopls" }, cmd = { "gopls" },
on_attach = common_lsp_on_attach, filetypes = { "go", "gomod" },
flags = common_lsp_flags, root_dir = util.root_pattern("go.work", "go.mod", ".git"),
capabilities = capabilities, on_attach = common_lsp_on_attach,
settings = { flags = common_lsp_flags,
gopls = { capabilities = capabilities,
experimentalPostfixCompletions = true, settings = {
analyses = { gopls = {
unusedparams = true, experimentalPostfixCompletions = true,
shadow = true, analyses = {
}, unusedparams = true,
}, shadow = true,
}, },
init_options = { usePlaceholders = 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 capabilities.textDocument.completion.completionItem.snippetSupport = true
require("lspconfig").jsonls.setup({ require("lspconfig").jsonls.setup({
capabilities = capabilities, capabilities = capabilities,
}) })
require("lspconfig").taplo.setup({}) 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({ require("bufferline").setup({
options = { options = {
-- 使用 nvim 内置lsp -- 使用 nvim 内置lsp
diagnostics = "nvim_lsp", diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict) diagnostics_indicator = function(count, level, diagnostics_dict)
return "("..count..")" return "(" .. count .. ")"
end, end,
always_show_bufferline = false, always_show_bufferline = false,
-- 左侧让出 nvim-tree 的位置 -- 左侧让出 nvim-tree 的位置
offsets = { offsets = {
{ {
filetype = "NvimTree", filetype = "NvimTree",
text = "File Explorer", text = "File Explorer",
highlight = "Directory", highlight = "Directory",
text_align = "left", 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 -- OR setup with some options
require("nvim-tree").setup({ require("nvim-tree").setup({
sort_by = "case_sensitive", auto_reload_on_write = true,
view = { sort_by = "case_sensitive",
width = 30, sync_root_with_cwd = true,
mappings = { respect_buf_cwd = true,
list = { update_focused_file = {
{ key = "u", action = "dir_up" }, enable = true,
}, update_root = true,
}, },
}, filters = { custom = { ".git" } },
renderer = { view = {
group_empty = true, width = 30,
}, mappings = {
filters = { list = {
dotfiles = true, { key = "u", action = "dir_up" },
}, },
},
},
renderer = {
group_empty = true,
},
}) })
local function open_nvim_tree(data) local function open_nvim_tree(data)
-- buffer is a directory -- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1 local directory = vim.fn.isdirectory(data.file) == 1
if not directory then if not directory then
return return
end end
-- change to the directory -- change to the directory
vim.cmd.cd(data.file) vim.cmd.cd(data.file)
-- open the tree -- open the tree
require("nvim-tree.api").tree.open() require("nvim-tree.api").tree.open()
end end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

View File

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

View File

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

View File

@ -2,11 +2,11 @@ require("leap").add_default_mappings()
require("leap").opts.highlight_unlabeled_phase_one_targets = true require("leap").opts.highlight_unlabeled_phase_one_targets = true
require("flit").setup({ require("flit").setup({
keys = { f = "f", F = "F", t = "t", T = "T" }, keys = { f = "f", F = "F", t = "t", T = "T" },
-- A string like "nv", "nvo", "o", etc. -- A string like "nv", "nvo", "o", etc.
labeled_modes = "v", labeled_modes = "v",
multiline = true, multiline = true,
-- Like `leap`s similar argument (call-specific overrides). -- Like `leap`s similar argument (call-specific overrides).
-- E.g.: opts = { equivalence_classes = {} } -- E.g.: opts = { equivalence_classes = {} }
opts = {}, 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({ require("lspsaga").setup({
ui = { ui = {
colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(), colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(),
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(), kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
}, },
}) })
require("lsp-colors").setup({ require("lsp-colors").setup({
Error = "#db4b4b", Error = "#db4b4b",
Warning = "#e0af68", Warning = "#e0af68",
Information = "#0db9d7", Information = "#0db9d7",
Hint = "#10B981" Hint = "#10B981",
}) })

View File

@ -1,40 +1,40 @@
require("lualine").setup({ require("lualine").setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = "tokyonight", theme = "tokyonight",
component_separators = { left = "|", right = "|" }, component_separators = { left = "|", right = "|" },
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
disabled_filetypes = { disabled_filetypes = {
statusline = {}, statusline = {},
winbar = {}, winbar = {},
}, },
ignore_focus = {}, ignore_focus = {},
always_divide_middle = true, always_divide_middle = true,
globalstatus = false, globalstatus = false,
refresh = { refresh = {
statusline = 1000, statusline = 1000,
tabline = 1000, tabline = 1000,
winbar = 1000, winbar = 1000,
}, },
}, },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" }, lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" }, lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" }, lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "location" }, lualine_z = { "location" },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_a = {},
lualine_b = {}, lualine_b = {},
lualine_c = { "filename" }, lualine_c = { "filename" },
lualine_x = { "location" }, lualine_x = { "location" },
lualine_y = {}, lualine_y = {},
lualine_z = {}, lualine_z = {},
}, },
tabline = {}, tabline = {},
winbar = {}, winbar = {},
inactive_winbar = {}, inactive_winbar = {},
extensions = {}, extensions = {},
}) })

View File

@ -1,33 +1,36 @@
require("mason").setup({ require("mason").setup({
ui = { ui = {
icons = { icons = {
package_installed = "", package_installed = "",
package_pending = "", package_pending = "",
package_uninstalled = "", package_uninstalled = "",
}, },
}, },
}) })
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { ensure_installed = {
"lua_ls", "clangd",
"rust_analyzer", "emmet_ls",
"gopls", "cmake",
"golangci_lint_ls", "gradle_ls",
"tsserver", "kotlin_language_server",
"volar", "lua_ls",
"taplo", "rust_analyzer",
"lemminx", "gopls",
"yamlls", "golangci_lint_ls",
"sqlls", "tsserver",
"jsonls", "volar",
"jdtls", "taplo",
"bashls", "yamlls",
"cssls", "jsonls",
"dockerls", "jdtls",
"docker_compose_language_service", "bashls",
"eslint", "cssls",
"html", "dockerls",
}, "docker_compose_language_service",
automatic_installation = true, "eslint",
"html",
},
automatic_installation = true,
}) })

View File

@ -1,43 +1,13 @@
local null_ls = require("null-ls") local null_ls = require("null-ls")
null_ls.setup({ null_ls.setup({
sources = { sources = {
null_ls.builtins.formatting.stylua, 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.gofmt,
null_ls.builtins.formatting.goimports_reviser, null_ls.builtins.formatting.eslint_d,
null_ls.builtins.formatting.google_java_format, null_ls.builtins.formatting.protolint,
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.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.eslint_d,
null_ls.builtins.diagnostics.gitlint, null_ls.builtins.diagnostics.protolint,
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,
},
}) })

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", "vim",
"vue", "vue",
"yaml", "yaml",
"proto",
}, },
-- Install parsers synchronously (only applied to `ensure_installed`) -- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = true, 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) ---- 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")! -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
incremental_selection = { incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {
init_selection = "<CR>", init_selection = "<CR>",
node_incremental = "<CR>", node_incremental = "<CR>",
node_decremental = "<BS>", node_decremental = "<BS>",
scope_incremental = "<TAB>", scope_incremental = "<TAB>",
}, },
}, },
indent = { indent = {
enable = true, 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() local packer_bootstrap = ensure_packer()
return require("packer").startup(function(use) return require("packer").startup(function(use)
use({ "wbthomason/packer.nvim" }) use({
use({ "folke/tokyonight.nvim" }) "https://github.com/lewis6991/impatient.nvim",
use({ "catppuccin/nvim", as = "catppuccin" }) config = function()
require("impatient")
end,
})
use({ "wbthomason/packer.nvim" })
use({ "folke/tokyonight.nvim" })
use({ "stevearc/dressing.nvim" })
use({ "catppuccin/nvim", as = "catppuccin" })
-- bufferline -- bufferline
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" }) use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
-- 行号模式自动切换 -- 行号模式自动切换
use({ "nkakouros-original/numbers.nvim" }) use({ "nkakouros-original/numbers.nvim" })
-- 模糊搜索 -- 文件树
use({ use({
"nvim-telescope/telescope.nvim", "nvim-tree/nvim-tree.lua",
tag = "0.1.1", requires = {
requires = { "nvim-tree/nvim-web-devicons", -- optional, for file icons
{ "nvim-lua/plenary.nvim" }, },
{ "nvim-treesitter/nvim-treesitter" }, tag = "nightly", -- optional, updated every week. (see issue #1193)
{ "kdheepak/lazygit.nvim" }, })
}, -- 终端管理
}) use({ "akinsho/toggleterm.nvim", tag = "*" })
-- 文件树 -- LSP管理器
use({ use({
"nvim-tree/nvim-tree.lua", "williamboman/mason.nvim",
requires = { "williamboman/mason-lspconfig.nvim",
"nvim-tree/nvim-web-devicons", -- optional, for file icons "neovim/nvim-lspconfig",
}, "jose-elias-alvarez/null-ls.nvim",
tag = "nightly", -- optional, updated every week. (see issue #1193) })
}) -- 命令行
-- 终端管理 use({
use({ "akinsho/toggleterm.nvim", tag = "*" }) "VonHeikemen/fine-cmdline.nvim",
-- LSP管理器 requires = {
use({ { "MunifTanjim/nui.nvim" },
"williamboman/mason.nvim", },
"williamboman/mason-lspconfig.nvim", })
"neovim/nvim-lspconfig", -- 通知
"jose-elias-alvarez/null-ls.nvim", use({ "rcarriga/nvim-notify" })
}) -- 缩进线
-- 命令行 use({ "lukas-reineke/indent-blankline.nvim" })
use({ -- 注释管理
"VonHeikemen/fine-cmdline.nvim", use({
requires = { "numToStr/Comment.nvim",
{ "MunifTanjim/nui.nvim" }, config = function()
}, require("Comment").setup({})
}) end,
-- 通知 })
use({ "rcarriga/nvim-notify" }) -- git管理
use({ "lewis6991/gitsigns.nvim" })
-- 缩进线 use({
use({ "lukas-reineke/indent-blankline.nvim" }) "nvim-lualine/lualine.nvim",
-- 注释管理 requires = { "kyazdani42/nvim-web-devicons", opt = true },
use({ })
"numToStr/Comment.nvim", -- 自动修复部分按键
config = function() use({ "tummetott/unimpaired.nvim" })
require("Comment").setup({}) -- 标签补全
end, use({ "windwp/nvim-autopairs" })
}) use({ "windwp/nvim-ts-autotag" })
-- git管理 -- 自动保存
use({ "lewis6991/gitsigns.nvim" }) use({
use({ "Pocco81/auto-save.nvim",
"nvim-lualine/lualine.nvim", })
requires = { "kyazdani42/nvim-web-devicons", opt = true }, -- lspsaga
}) use({
use({ "glepnir/lspsaga.nvim",
"windwp/nvim-autopairs", branch = "main",
config = function() requires = {
require("nvim-autopairs").setup({}) "nvim-tree/nvim-web-devicons",
end, --Please make sure you install markdown and markdown_inline parser
})
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({
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
run = ":TSUpdate", "folke/lsp-colors.nvim",
}) },
-- 自动完成相关 })
use({ -- 错误列表
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", "hrsh7th/nvim-cmp",
requires = { "hrsh7th/cmp-vsnip",
"onsails/lspkind-nvim", "hrsh7th/vim-vsnip",
"octaltree/cmp-look", "hrsh7th/cmp-emoji",
"hrsh7th/cmp-nvim-lsp", },
"hrsh7th/cmp-buffer", })
"hrsh7th/cmp-path", use({
"hrsh7th/cmp-calc", "L3MON4D3/LuaSnip",
"hrsh7th/cmp-cmdline", requires = {
"hrsh7th/nvim-cmp", "rafamadriz/friendly-snippets",
"hrsh7th/cmp-vsnip", },
"hrsh7th/vim-vsnip", -- follow latest release.
"hrsh7th/cmp-emoji", tag = "v<CurrentMajor>.*",
}, -- install jsregexp (optional!:).
}) run = "make install_jsregexp",
-- golang ide })
use({ -- golang ide
"ray-x/go.nvim", use({
"ray-x/guihua.lua", -- recommended if need floating window support "ray-x/go.nvim",
}) "ray-x/guihua.lua", -- recommended if need floating window support
-- 高亮当前关键词 })
use({ "RRethy/vim-illuminate" }) -- 高亮当前关键词
use({ "RRethy/vim-illuminate" })
-- 自动保存 -- 罗列文件中的所有url
if packer_bootstrap then use("axieax/urlview.nvim")
require("packer").sync() -- 快捷键提示
end use({
end) "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)