chore: refactor

This commit is contained in:
♥ Minnie ♥ 2025-04-04 22:43:59 +08:00
parent feb7679637
commit 92dcce1c43
Signed by: jasmine
GPG key ID: 8563E358D4E8040E

View file

@ -2,23 +2,30 @@
# Autocompletion plugin # Autocompletion plugin
plugins.cmp = { plugins.cmp = {
enable = true; enable = true;
autoEnableSources = true;
# Options provided to the require('cmp').setup function. # Options provided to the require('cmp').setup function.
settings = { settings = {
# The sources to use # The sources to use
sources = [ sources = [
{name = "nvim_lsp";} # LSP source for cmp { # Language Server Protocol
{name = "luasnip";} # Snippets source for cmp name = "nvim_lsp";
{name = "path";} # Filesystem paths }
{ # Buffer Words
name = "buffer";
}
{ # Filesystem paths
name = "path";
}
{ # Command line
name = "cmdline";
}
]; ];
# The snippet expansion function.
snippet.expand = # Key mappings for the completion menu.
#Lua
''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
# cmp mappings declaration
mapping = { mapping = {
"<esc>" = "<esc>" =
# Lua # Lua
@ -34,7 +41,5 @@
"cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })"; "cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })";
}; };
}; };
# Scans the sources array and enable the corresponding plugins if they are known to nixvim.
autoEnableSources = true;
}; };
} }