chore(nvim): improved cmp performance and added fugitive

This commit is contained in:
Afonso Franco 2024-09-04 15:30:52 +01:00
parent 3190c83a91
commit 1d5291c270
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
3 changed files with 28 additions and 2 deletions

View file

@ -1,6 +1,7 @@
return { return {
{ {
"hrsh7th/nvim-cmp", "yioneko/nvim-cmp",
branch = "perf",
event = "VeryLazy", event = "VeryLazy",
dependencies = { dependencies = {
"hrsh7th/cmp-nvim-lsp", -- lsp "hrsh7th/cmp-nvim-lsp", -- lsp
@ -28,6 +29,10 @@ return {
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end, end,
}, },
performance = {
debounce = 0,
throttle = 0,
},
mapping = { mapping = {
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),

View file

@ -6,5 +6,6 @@ return {
require("blame").setup() require("blame").setup()
end end
}, },
"https://github.com/tpope/vim-fugitive"
} }

View file

@ -3,6 +3,22 @@ return {
{ {
"stevearc/dressing.nvim", "stevearc/dressing.nvim",
event = "VeryLazy", event = "VeryLazy",
opts = {
input = {
override = function(conf)
conf.col = -1
conf.row = 0
return conf
end,
}
}
},
{
"smjonas/inc-rename.nvim",
opts = {
input_buffer_type = "dressing",
save_in_cmdline_history = true,
}
}, },
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
@ -165,6 +181,10 @@ return {
client.server_capabilities.semanticTokensProvider = nil client.server_capabilities.semanticTokensProvider = nil
end end
local rename_func = function()
return ":IncRename " .. vim.fn.expand("<cword>")
end
-- Mappings. -- Mappings.
local bufopts = { noremap = true, silent = true, buffer = ev.buf } local bufopts = { noremap = true, silent = true, buffer = ev.buf }
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, bufopts) vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, bufopts)
@ -176,7 +196,7 @@ return {
vim.keymap.set("n", "gi", fzflua.lsp_implementations, bufopts) vim.keymap.set("n", "gi", fzflua.lsp_implementations, bufopts)
vim.keymap.set("n", "<space>k", vim.lsp.buf.signature_help, bufopts) vim.keymap.set("n", "<space>k", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, 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>rn", rename_func(), bufopts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts) vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<space>ge", vim.diagnostic.goto_next, bufopts) vim.keymap.set("n", "<space>ge", vim.diagnostic.goto_next, bufopts)
vim.keymap.set("n", "<space>gE", vim.diagnostic.goto_prev, bufopts) vim.keymap.set("n", "<space>gE", vim.diagnostic.goto_prev, bufopts)