modify nixvim
- add config for nixd - fix luasnip call func in cmp - enable autocomplete in cmp- cmdline - add cmp-cmdline mapping
This commit is contained in:
parent
71ac9901dd
commit
bd3f24056e
|
@ -3,6 +3,7 @@
|
||||||
cmp-emoji = { enable = true; };
|
cmp-emoji = { enable = true; };
|
||||||
cmp = {
|
cmp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
cmdline = {};
|
||||||
settings = {
|
settings = {
|
||||||
autoEnableSources = true;
|
autoEnableSources = true;
|
||||||
experimental = { ghost_text = true; };
|
experimental = { ghost_text = true; };
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
fetchingTimeout = 200;
|
fetchingTimeout = 200;
|
||||||
maxViewEntries = 30;
|
maxViewEntries = 30;
|
||||||
};
|
};
|
||||||
snippet = { expand = "luasnip"; };
|
snippet = { expand = "function(args) require('luasnip').lsp_expand(args.body) end"; };
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = [ "kind" "abbr" "menu" ];
|
fields = [ "kind" "abbr" "menu" ];
|
||||||
format = ''
|
format = ''
|
||||||
|
@ -43,14 +44,10 @@
|
||||||
};
|
};
|
||||||
mapping = {
|
mapping = {
|
||||||
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
||||||
"<C-j>" = "cmp.mapping.select_next_item()";
|
"<S-Tab>" = "cmp.mapping.select_prev_item()";
|
||||||
"<C-k>" = "cmp.mapping.select_prev_item()";
|
|
||||||
"<C-e>" = "cmp.mapping.abort()";
|
|
||||||
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
|
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
|
||||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||||
"<C-Space>" = "cmp.mapping.complete()";
|
|
||||||
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||||
"<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -58,7 +55,7 @@
|
||||||
cmp-buffer = { enable = true; };
|
cmp-buffer = { enable = true; };
|
||||||
cmp-path = { enable = true; }; # file system paths
|
cmp-path = { enable = true; }; # file system paths
|
||||||
cmp_luasnip = { enable = true; }; # snippets
|
cmp_luasnip = { enable = true; }; # snippets
|
||||||
cmp-cmdline = { enable = false; }; # autocomplete for cmdline
|
cmp-cmdline = { enable = true; }; # autocomplete for cmdline
|
||||||
};
|
};
|
||||||
programs.nixvim.extraConfigLua = ''
|
programs.nixvim.extraConfigLua = ''
|
||||||
luasnip = require("luasnip")
|
luasnip = require("luasnip")
|
||||||
|
@ -94,22 +91,15 @@
|
||||||
|
|
||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||||
cmp.setup.cmdline({'/', "?" }, {
|
cmp.setup.cmdline({'/', "?" }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'buffer' }
|
{ name = 'buffer' }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set configuration for specific filetype.
|
|
||||||
cmp.setup.filetype('gitcommit', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'path' }
|
{ name = 'path' }
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -4,7 +4,17 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
servers = {
|
servers = {
|
||||||
lua-ls = {enable = true;};
|
lua-ls = {enable = true;};
|
||||||
nixd = {enable = true;};
|
nixd = {
|
||||||
|
enable = true;
|
||||||
|
cmd = ["nixd"];
|
||||||
|
settings = {
|
||||||
|
nixpkgs.expr = "import <nixpkgs> { }";
|
||||||
|
options = {
|
||||||
|
nixos.expr = "(builtins.getFlake ('git+file://' + toString ./.)).nixosConfigurations.k-on.options";
|
||||||
|
home_manager.expr = "(builtins.getFlake ('git+file://' + toString ./.)).homeConfigurations.'ruixi@k-on'.options";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
bashls = {enable = true;};
|
bashls = {enable = true;};
|
||||||
pyright = {enable = true;};
|
pyright = {enable = true;};
|
||||||
html = {enable = true;};
|
html = {enable = true;};
|
||||||
|
|
Loading…
Reference in New Issue