🔧 Update Cmp and lsp

Signed-off-by: Ryan <ryan@alien.gov>
This commit is contained in:
Ryan 2023-11-11 15:04:42 +08:00
parent beca3b8c5b
commit df79641853
6 changed files with 48 additions and 24 deletions

5
lua/.luarc.json Normal file
View File

@ -0,0 +1,5 @@
{
"diagnostics.disable": [
"undefined-global"
]
}

View File

@ -60,9 +60,7 @@ local plugins = {
-- TODO: check the cmp sources -- TODO: check the cmp sources
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-document-symbol",
"FelipeLema/cmp-async-path", "FelipeLema/cmp-async-path",
"petertriho/cmp-git",
"ray-x/cmp-treesitter", "ray-x/cmp-treesitter",
{ {
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
@ -75,13 +73,18 @@ local plugins = {
config = function() config = function()
require("plugins.nvim-autopairs") require("plugins.nvim-autopairs")
end end
} },
}, },
event = { "InsertEnter", "CmdlineEnter" }, event = { "InsertEnter", "CmdlineEnter" },
config = function() config = function()
require("plugins/cmp") require("plugins/cmp")
end end
}, },
{
"Dynge/gitmoji.nvim",
ft = "gitcommit",
dependencies = "hrsh7th/nvim-cmp"
},
{ {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
dependencies = { dependencies = {
@ -110,7 +113,6 @@ local plugins = {
"jose-elias-alvarez/null-ls.nvim" "jose-elias-alvarez/null-ls.nvim"
} }
}, },
-- Code editing -- Code editing
{ {
"machakann/vim-sandwich", "machakann/vim-sandwich",
@ -134,8 +136,21 @@ local plugins = {
require("plugins.telescope") require("plugins.telescope")
end end
}, },
{
"tpope/vim-fugitive",
event = "CmdlineEnter"
},
-- Eye candy UI -- Eye candy UI
{
"NvChad/nvim-colorizer.lua",
cmd = { "ColorizerAttachToBuffer",
"ColorizerToggle"
},
config = function()
require("colorizer").setup()
end
},
{ {
"winston0410/range-highlight.nvim", "winston0410/range-highlight.nvim",
event = "CmdlineEnter" event = "CmdlineEnter"
@ -151,9 +166,15 @@ local plugins = {
{ {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = "BufEnter", event = "BufEnter",
config = function() opts = {
require('gitsigns').setup() signcolumn = false,
end numhl = true,
current_line_blame_opts = {
delay = 300,
ignore_whitespace = false,
virt_text_priority = 100,
},
},
} }
} }
@ -166,6 +187,7 @@ local vscode_plugins = {
require("Comment").setup() require("Comment").setup()
end end
}, },
"tpope/vim-fugitive"
} }
if vim.g.vscode then if vim.g.vscode then

View File

@ -70,11 +70,12 @@ cmp.setup.cmdline({ '/', '?' }, {
-- Set configuration for specific filetype. -- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', { cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({ sources = cmp.config.sources(
{ name = 'git' }, -- You can specify the `cmp_git` source if you were installed it. {
}, { { name = 'buffer' },
{ name = 'buffer' }, }, {
}) { name = 'gitmoji' }
})
}) })
-- `:` cmdline setup. -- `:` cmdline setup.
@ -91,5 +92,3 @@ cmp.setup.cmdline(':', {
} }
}) })
}) })
require("cmp_git").setup()

View File

@ -1,4 +0,0 @@
require"lsp_signature".setup({
hint_enable = false,
zindex = 50,
})

View File

@ -3,7 +3,7 @@
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float) vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next) vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist) vim.keymap.set('n', '<space>qf', vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys -- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
@ -50,3 +50,10 @@ require("mason-lspconfig").setup_handlers {
-- For example, a handler override for the `rust_analyzer`: -- For example, a handler override for the `rust_analyzer`:
["rust_analyzer"] = function() require("rust-tools").setup {} end ["rust_analyzer"] = function() require("rust-tools").setup {} end
} }
-- customize lsp symbols
local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶 ", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = nil })
end

View File

@ -1,5 +0,0 @@
require'nvim-treesitter.configs'.setup {
matchup = {
enable = true -- mandatory, false will disable the whole extension
}
}