mirror of
https://github.com/cap153/nvim.git
synced 2026-01-09 04:42:48 +08:00
添加fzf-lua配置
This commit is contained in:
parent
6d2c60eedc
commit
557287033b
8 changed files with 78 additions and 50 deletions
|
|
@ -1,36 +1,38 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "mason-org/mason-lspconfig.nvim" },
|
||||
-- 通过mason来自动安装语言服务器并启用
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
{
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
-- "gopls",
|
||||
},
|
||||
automatic_enable = {
|
||||
exclude = {
|
||||
"marksman",
|
||||
"pylsp",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "MysticalDevil/inlay-hints.nvim", event = "LspAttach" },
|
||||
},
|
||||
config = function()
|
||||
-- 通过mason来自动安装语言服务器并启用
|
||||
require("mason").setup({})
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"rust_analyzer",
|
||||
"pylsp",
|
||||
-- "gopls",
|
||||
},
|
||||
automatic_enable = {
|
||||
exclude = {},
|
||||
},
|
||||
})
|
||||
|
||||
-- 快捷键的映射
|
||||
vim.keymap.set("n", "<leader>h", vim.lsp.buf.hover, opts) -- <space>h显示提示文档
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) -- gd跳转到定义的位置
|
||||
vim.keymap.set("n", "go", vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- <space>rn变量重命名
|
||||
vim.keymap.set("n", "<leader>aw", vim.lsp.buf.code_action, opts) -- <space>aw可以在出现警告或错误的地方打开建议的修复方法
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- <space>d浮动窗口显示所在行警告或错误信息
|
||||
vim.keymap.set("n", "<leader>-", vim.diagnostic.goto_prev, opts) -- <space>-跳转到上一处警告或错误的地方
|
||||
vim.keymap.set("n", "<leader>=", vim.diagnostic.goto_next, opts) -- <space>+跳转到下一处警告或错误的地方
|
||||
vim.keymap.set("n", "<leader>h", vim.lsp.buf.hover, opts) -- <space>h显示提示文档
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) -- gd跳转到定义
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) -- gD跳转到声明(例如c语言中的头文件中的原型、一个变量的extern声明)
|
||||
vim.keymap.set("n", "go", vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置(例如一些自定义类型)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- <space>rn变量重命名
|
||||
vim.keymap.set("n", "<leader>aw", vim.lsp.buf.code_action, opts) -- <space>aw可以在出现警告或错误的地方打开建议的修复方法
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- <space>d浮动窗口显示所在行警告或错误信息
|
||||
vim.keymap.set("n", "<leader>-", vim.diagnostic.goto_prev, opts) -- <space>-跳转到上一处警告或错误的地方
|
||||
vim.keymap.set("n", "<leader>=", vim.diagnostic.goto_next, opts) -- <space>+跳转到下一处警告或错误的地方
|
||||
-- vim.keymap.set({ 'n', 'x' }, '<leader>f', function() vim.lsp.buf.format({ async = true }) end, opts) -- <space>f进行代码格式化
|
||||
|
||||
-- 诊断信息的图标
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue