mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
chore: apply nixvim updates
This commit is contained in:
parent
1b0934b565
commit
e9fbbb9c7d
7 changed files with 316 additions and 232 deletions
|
@ -20,116 +20,147 @@
|
|||
cmp-nvim-lsp.enable = true;
|
||||
cmp-nvim-lsp-document-symbol.enable = true;
|
||||
cmp-nvim-lsp-signature-help.enable = true;
|
||||
nvim-cmp = {
|
||||
cmp = {
|
||||
enable = true;
|
||||
sources = [
|
||||
{name = "nvim_lsp_signature_help";}
|
||||
{name = "nvim_lsp";}
|
||||
{name = "nvim_lsp_document_symbol";}
|
||||
{name = "path";}
|
||||
{name = "treesitter";}
|
||||
{name = "luasnip";}
|
||||
{name = "emoji";}
|
||||
];
|
||||
mappingPresets = ["insert"];
|
||||
mapping = {
|
||||
"<CR>" = ''
|
||||
cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
})
|
||||
'';
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-e>" = "cmp.mapping.abort()";
|
||||
"<Tab>" = {
|
||||
modes = ["i" "s"];
|
||||
action = ''
|
||||
function(fallback)
|
||||
local has_words_before = function()
|
||||
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||
end
|
||||
settings = {
|
||||
sources = [
|
||||
{name = "nvim_lsp_signature_help";}
|
||||
{name = "nvim_lsp";}
|
||||
{name = "nvim_lsp_document_symbol";}
|
||||
{name = "path";}
|
||||
{name = "treesitter";}
|
||||
{name = "luasnip";}
|
||||
{name = "emoji";}
|
||||
];
|
||||
mapping = {
|
||||
"<CR>" =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
})
|
||||
'';
|
||||
"<C-d>" =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
"cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
"cmp.mapping.scroll_docs(4)";
|
||||
"<C-e>" =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
"cmp.mapping.abort()";
|
||||
"<Tab>" =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
cmp.mapping(function(fallback)
|
||||
local has_words_before = function()
|
||||
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||
end
|
||||
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expandable() then
|
||||
require("luasnip").expand()
|
||||
elseif require("luasnip").expand_or_locally_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expandable() then
|
||||
require("luasnip").expand()
|
||||
elseif require("luasnip").expand_or_locally_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"})
|
||||
'';
|
||||
"<S-Tab>" =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"})
|
||||
'';
|
||||
};
|
||||
formatting.fields = ["abbr" "kind" "menu"];
|
||||
formatting.format =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function(_, vim_item)
|
||||
local icons = {
|
||||
Namespace = "",
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
Table = "",
|
||||
Object = "",
|
||||
Tag = "",
|
||||
Array = "",
|
||||
Boolean = "",
|
||||
Number = "",
|
||||
Null = "",
|
||||
String = "",
|
||||
Calendar = "",
|
||||
Watch = "",
|
||||
Package = "",
|
||||
Copilot = "",
|
||||
Codeium = "",
|
||||
TabNine = "",
|
||||
}
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
return vim_item
|
||||
end
|
||||
'';
|
||||
};
|
||||
"<S-Tab>" = {
|
||||
modes = ["i" "s"];
|
||||
action = ''
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
snippet.expand =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
formatting.fields = ["abbr" "kind" "menu"];
|
||||
formatting.format = ''
|
||||
function(_, vim_item)
|
||||
local icons = {
|
||||
Namespace = "",
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
Table = "",
|
||||
Object = "",
|
||||
Tag = "",
|
||||
Array = "",
|
||||
Boolean = "",
|
||||
Number = "",
|
||||
Null = "",
|
||||
String = "",
|
||||
Calendar = "",
|
||||
Watch = "",
|
||||
Package = "",
|
||||
Copilot = "",
|
||||
Codeium = "",
|
||||
TabNine = "",
|
||||
}
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
return vim_item
|
||||
end
|
||||
'';
|
||||
snippet.expand = "luasnip";
|
||||
};
|
||||
|
||||
# TODO use "ray-x/lsp_signature.nvim"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue