fix
This commit is contained in:
parent
a603a646dd
commit
2937f9e309
|
@ -2,7 +2,7 @@
|
|||
|
||||
一个neovim配置
|
||||
|
||||
### usage
|
||||
### usage hello world me help, good.
|
||||
|
||||
安装插件管理工具
|
||||
|
||||
|
|
5
init.lua
5
init.lua
|
@ -34,12 +34,11 @@ require("plugins.mason")
|
|||
require("lsp.init")
|
||||
require("lsp.lua")
|
||||
require("lsp.go")
|
||||
require("lsp.yaml")
|
||||
require("lsp.json")
|
||||
require("lsp.toml")
|
||||
require("lsp.protocol")
|
||||
require("lsp.bash")
|
||||
require("lsp.docker")
|
||||
require("lsp.html")
|
||||
require("plugins.lspsaga")
|
||||
-- golang ide config
|
||||
require("plugins.go")
|
||||
-- 格式化
|
||||
|
|
|
@ -27,7 +27,7 @@ map("x", "<A-j>", ":move '>+1<CR>gv-gv", noreopt)
|
|||
map("x", "<A-k>", ":move '<-2<CR>gv-gv", noreopt)
|
||||
-- 快所退出
|
||||
map("n", "q", ":wq<CR>", noreopt)
|
||||
map("n", "qn", ":q!<CR>", noreopt)
|
||||
map("n", "qq", ":q!<CR>", noreopt)
|
||||
map("i", "jk", "<ESC>", noreopt)
|
||||
-- git 管理
|
||||
map("n", "<leader>lg", ":LazyGit<CR>", noreopt)
|
||||
|
@ -76,3 +76,95 @@ map("n", "n", "n:Beacon<CR>", noreopt)
|
|||
map("n", "N", "N:Beacon<CR>", noreopt)
|
||||
map("n", "*", "*:Beacon<CR>", noreopt)
|
||||
map("n", "#", "#:Beacon<CR>", noreopt)
|
||||
-- markdown
|
||||
map("n", "<leader>mp", ":MarkdownPreviewToggle<CR>", noreopt)
|
||||
-- lspsage
|
||||
function _G.set_lspsage_keymaps()
|
||||
local keymap = vim.keymap.set
|
||||
-- LSP finder - Find the symbol's definition
|
||||
-- If there is no definition, it will instead be hidden
|
||||
-- When you use an action in finder like "open vsplit",
|
||||
-- you can use <C-t> to jump back
|
||||
keymap("n", "cf", "<cmd>Lspsaga lsp_finder<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 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>")
|
||||
|
||||
-- Go to definition
|
||||
keymap("n", "gd", "<cmd>Lspsaga goto_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>")
|
||||
|
||||
-- Go to type definition
|
||||
keymap("n", "gt", "<cmd>Lspsaga goto_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 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>")
|
||||
|
||||
-- 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)
|
||||
|
||||
-- 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>")
|
||||
|
||||
-- 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>")
|
||||
|
||||
-- Floating terminal
|
||||
keymap({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")
|
||||
end
|
||||
|
||||
vim.cmd("lua set_lspsage_keymaps()")
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
common_lsp_on_attach = function(client, bufnr)
|
||||
|
@ -15,31 +7,6 @@ common_lsp_on_attach = function(client, bufnr)
|
|||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set("n", "<space>f", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, bufopts)
|
||||
end
|
||||
|
||||
common_lsp_flags = {
|
||||
|
|
|
@ -5,3 +5,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|||
require("lspconfig").jsonls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").taplo.setup({})
|
||||
|
||||
require("lspconfig").yamlls.setup({})
|
|
@ -1 +0,0 @@
|
|||
require("lspconfig").taplo.setup({})
|
|
@ -1 +0,0 @@
|
|||
require("lspconfig").yamlls.setup({})
|
|
@ -1 +1 @@
|
|||
require("auto-save").setup {}
|
||||
-- require("auto-save").setup {}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require("catppuccin").setup({
|
||||
integrations = {
|
||||
lsp_saga = true
|
||||
}
|
||||
})
|
|
@ -0,0 +1,6 @@
|
|||
require("lspsaga").setup({
|
||||
ui = {
|
||||
colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors(),
|
||||
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
|
||||
},
|
||||
})
|
|
@ -7,6 +7,7 @@ require("nvim-tree").setup({
|
|||
enable = true,
|
||||
update_root = true,
|
||||
},
|
||||
filters = { custom = { ".git" } },
|
||||
view = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require("project_nvim").setup({
|
||||
patterns = { "project.md" },
|
||||
exclude_dirs = { ".git", "node_modules", "dist", "target" },
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
return require("packer").startup(function(use)
|
||||
use({ "wbthomason/packer.nvim" })
|
||||
-- 主题
|
||||
use({ "catppuccin/nvim", as = "catppuccin" })
|
||||
use({ "ellisonleao/gruvbox.nvim" })
|
||||
-- 文件树
|
||||
use({
|
||||
|
@ -91,6 +92,15 @@ return require("packer").startup(function(use)
|
|||
"ray-x/go.nvim",
|
||||
"ray-x/guihua.lua", -- recommended if need floating window support
|
||||
})
|
||||
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" },
|
||||
},
|
||||
})
|
||||
-- 自动完成相关
|
||||
use({
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
|
@ -110,5 +120,14 @@ return require("packer").startup(function(use)
|
|||
})
|
||||
-- 上下高亮跳动
|
||||
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" },
|
||||
})
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
end)
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
require("telescope").load_extension("lazygit", "projects")
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
projects = {},
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue