chore: apply nixvim updates

This commit is contained in:
oddlama 2024-03-11 20:41:28 +01:00
parent 1b0934b565
commit e9fbbb9c7d
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
7 changed files with 316 additions and 232 deletions

View file

@ -31,7 +31,11 @@
{ {
type = "button"; type = "button";
val = " New file"; val = " New file";
on_press.__raw = "function() vim.cmd[[enew]] end"; on_press.__raw =
/*
lua
*/
"function() vim.cmd[[enew]] end";
opts = { opts = {
shortcut = "e"; shortcut = "e";
position = "center"; position = "center";
@ -54,7 +58,11 @@
{ {
type = "button"; type = "button";
val = "󰅙 Quit Neovim"; val = "󰅙 Quit Neovim";
on_press.__raw = "function() vim.cmd[[qa]] end"; on_press.__raw =
/*
lua
*/
"function() vim.cmd[[qa]] end";
opts = { opts = {
shortcut = "q"; shortcut = "q";
position = "center"; position = "center";

View file

@ -20,116 +20,147 @@
cmp-nvim-lsp.enable = true; cmp-nvim-lsp.enable = true;
cmp-nvim-lsp-document-symbol.enable = true; cmp-nvim-lsp-document-symbol.enable = true;
cmp-nvim-lsp-signature-help.enable = true; cmp-nvim-lsp-signature-help.enable = true;
nvim-cmp = { cmp = {
enable = true; enable = true;
sources = [ settings = {
{name = "nvim_lsp_signature_help";} sources = [
{name = "nvim_lsp";} {name = "nvim_lsp_signature_help";}
{name = "nvim_lsp_document_symbol";} {name = "nvim_lsp";}
{name = "path";} {name = "nvim_lsp_document_symbol";}
{name = "treesitter";} {name = "path";}
{name = "luasnip";} {name = "treesitter";}
{name = "emoji";} {name = "luasnip";}
]; {name = "emoji";}
mappingPresets = ["insert"]; ];
mapping = { mapping = {
"<CR>" = '' "<CR>" =
cmp.mapping.confirm({ /*
behavior = cmp.ConfirmBehavior.Replace, lua
select = false, */
}) ''
''; cmp.mapping.confirm({
"<C-d>" = "cmp.mapping.scroll_docs(-4)"; behavior = cmp.ConfirmBehavior.Replace,
"<C-f>" = "cmp.mapping.scroll_docs(4)"; select = false,
"<C-e>" = "cmp.mapping.abort()"; })
"<Tab>" = { '';
modes = ["i" "s"]; "<C-d>" =
action = '' /*
function(fallback) lua
local has_words_before = function() */
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0)) "cmp.mapping.scroll_docs(-4)";
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil "<C-f>" =
end /*
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 if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif require("luasnip").expandable() then elseif require("luasnip").expandable() then
require("luasnip").expand() require("luasnip").expand()
elseif require("luasnip").expand_or_locally_jumpable() then elseif require("luasnip").expand_or_locally_jumpable() then
require("luasnip").expand_or_jump() require("luasnip").expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
else else
fallback() fallback()
end 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 end
''; '';
}; snippet.expand =
"<S-Tab>" = { /*
modes = ["i" "s"]; lua
action = '' */
function(fallback) ''
if cmp.visible() then function(args)
cmp.select_prev_item() require('luasnip').lsp_expand(args.body)
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end 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" # TODO use "ray-x/lsp_signature.nvim"

View file

@ -51,26 +51,34 @@
{ {
event = ["BufEnter" "BufWinEnter"]; event = ["BufEnter" "BufWinEnter"];
pattern = ["term://*"]; pattern = ["term://*"];
callback.__raw = '' callback.__raw =
function() /*
vim.bo.number = false lua
end */
''; ''
function()
vim.bo.number = false
end
'';
} }
{ {
event = ["WinEnter"]; event = ["WinEnter"];
pattern = ["*"]; pattern = ["*"];
callback.__raw = '' callback.__raw =
function() /*
pcall(function() lua
if vim.bo.buftype == "nofile" or vim.bo.buftype == "help" then */
vim.cmd "DisableWhitespace" ''
else function()
vim.cmd "EnableWhitespace" pcall(function()
end if vim.bo.buftype == "nofile" or vim.bo.buftype == "help" then
end) vim.cmd "DisableWhitespace"
end else
''; vim.cmd "EnableWhitespace"
end
end)
end
'';
} }
]; ];

View file

@ -6,19 +6,23 @@
programs.nixvim.plugins = { programs.nixvim.plugins = {
lsp = { lsp = {
enable = true; enable = true;
preConfig = '' preConfig =
local lsp_symbol = function(name, icon) /*
vim.fn.sign_define( lua
"DiagnosticSign" .. name, */
{ text = icon, numhl = "Diagnostic" .. name, texthl = "Diagnostic" .. name } ''
) local lsp_symbol = function(name, icon)
end vim.fn.sign_define(
"DiagnosticSign" .. name,
{ text = icon, numhl = "Diagnostic" .. name, texthl = "Diagnostic" .. name }
)
end
lsp_symbol("Error", "󰅙") lsp_symbol("Error", "󰅙")
lsp_symbol("Info", "") lsp_symbol("Info", "")
lsp_symbol("Hint", "󰌵") lsp_symbol("Hint", "󰌵")
lsp_symbol("Warn", "") lsp_symbol("Warn", "")
''; '';
servers = { servers = {
bashls.enable = true; bashls.enable = true;
cssls.enable = true; cssls.enable = true;

View file

@ -4,7 +4,11 @@
notify = { notify = {
enable = true; enable = true;
stages = "static"; stages = "static";
render.__raw = ''"compact"''; render.__raw =
/*
lua
*/
''"compact"'';
icons = { icons = {
debug = ""; debug = "";
error = "󰅙"; error = "󰅙";
@ -68,39 +72,47 @@
vim-startuptime vim-startuptime
]; ];
extraConfigLuaPre = '' extraConfigLuaPre =
vim.g.operator_sandwich_no_default_key_mappings = 1 /*
vim.g.textobj_sandwich_no_default_key_mappings = 1 lua
*/
''
vim.g.operator_sandwich_no_default_key_mappings = 1
vim.g.textobj_sandwich_no_default_key_mappings = 1
vim.g.wordmotion_nomap = 1 vim.g.wordmotion_nomap = 1
''; '';
extraConfigLuaPost = '' extraConfigLuaPost =
require("window-picker").setup { /*
hint = "floating-big-letter", lua
filter_rules = { */
bo = { ''
filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" }, require("window-picker").setup {
buftype = { "terminal", "quickfix", "prompt" }, hint = "floating-big-letter",
filter_rules = {
bo = {
filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" },
buftype = { "terminal", "quickfix", "prompt" },
},
}, },
}, floating_big_letter = {
floating_big_letter = { font = "ansi-shadow",
font = "ansi-shadow",
},
selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
show_prompt = false,
}
require("dressing").setup {
input = {
prefer_width = 80,
max_width = { 140, 0.9 },
min_width = { 80, 0.6 },
win_options = {
winblend = 0,
}, },
}, selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
} show_prompt = false,
''; }
require("dressing").setup {
input = {
prefer_width = 80,
max_width = { 140, 0.9 },
min_width = { 80, 0.6 },
win_options = {
winblend = 0,
},
},
}
'';
}; };
} }

View file

@ -15,10 +15,26 @@
"t" = "open_tabnew"; "t" = "open_tabnew";
"z" = "close_all_nodes"; "z" = "close_all_nodes";
"Z" = "expand_all_nodes"; "Z" = "expand_all_nodes";
"a".__raw = ''{ "add", config = { show_path = "relative" } }''; "a".__raw =
"A".__raw = ''{ "add_directory", config = { show_path = "relative" } }''; /*
"c".__raw = ''{ "copy", config = { show_path = "relative" } }''; lua
"m".__raw = ''{ "move", config = { show_path = "relative" } }''; */
''{ "add", config = { show_path = "relative" } }'';
"A".__raw =
/*
lua
*/
''{ "add_directory", config = { show_path = "relative" } }'';
"c".__raw =
/*
lua
*/
''{ "copy", config = { show_path = "relative" } }'';
"m".__raw =
/*
lua
*/
''{ "move", config = { show_path = "relative" } }'';
}; };
}; };
defaultComponentConfigs = { defaultComponentConfigs = {

View file

@ -9,73 +9,78 @@
onedark-nvim onedark-nvim
]; ];
extraConfigLua = lib.mkBefore '' extraConfigLua =
local onedark = require "onedark" lib.mkBefore
onedark.setup { /*
toggle_style_key = "<nop>", lua
colors = { */
fg = "#abb2bf", ''
black = "#181a1f", local onedark = require "onedark"
bg0 = "#1e222a", onedark.setup {
bg1 = "#252931", toggle_style_key = "<nop>",
bg2 = "#282c34", colors = {
bg3 = "#353b45", fg = "#abb2bf",
bg_d = "#191c21", black = "#181a1f",
bg_blue = "#73b8f1", bg0 = "#1e222a",
bg_yellow = "#ebd09c", bg1 = "#252931",
bg2 = "#282c34",
bg3 = "#353b45",
bg_d = "#191c21",
bg_blue = "#73b8f1",
bg_yellow = "#ebd09c",
dark_cyan = "#2b6f77", dark_cyan = "#2b6f77",
dark_red = "#993939", dark_red = "#993939",
dark_yellow = "#93691d", dark_yellow = "#93691d",
grey = "#42464e", grey = "#42464e",
grey_fg = "#565c64", grey_fg = "#565c64",
grey_fg2 = "#6f737b", grey_fg2 = "#6f737b",
light_grey = "#6f737b", light_grey = "#6f737b",
baby_pink = "#de8c92", baby_pink = "#de8c92",
pink = "#ff75a0", pink = "#ff75a0",
nord_blue = "#81a1c1", nord_blue = "#81a1c1",
sun = "#ebcb8b", sun = "#ebcb8b",
light_purple = "#de98fd", light_purple = "#de98fd",
dark_purple = "#c882e7", dark_purple = "#c882e7",
teal = "#519aba", teal = "#519aba",
dark_pink = "#fca2aa", dark_pink = "#fca2aa",
light_blue = "#a3b8ef", light_blue = "#a3b8ef",
vibrant_green = "#7eca9c", vibrant_green = "#7eca9c",
red = "#e06c75", red = "#e06c75",
orange = "#d19a66", orange = "#d19a66",
yellow = "#e5c07b", yellow = "#e5c07b",
green = "#98c379", green = "#98c379",
cyan = "#56b6c2", cyan = "#56b6c2",
blue = "#61afef", blue = "#61afef",
purple = "#c678dd", purple = "#c678dd",
diff_add = "#31392b", diff_add = "#31392b",
diff_delete = "#382b2c", diff_delete = "#382b2c",
diff_change = "#1c3448", diff_change = "#1c3448",
diff_text = "#2c5372", diff_text = "#2c5372",
}, },
highlights = { highlights = {
CursorLine = { bg = "$bg0" }, CursorLine = { bg = "$bg0" },
FloatBorder = { fg = "$blue" }, FloatBorder = { fg = "$blue" },
NeoTreeTabActive = { fg = "$fg", bg = "$bg_d" }, NeoTreeTabActive = { fg = "$fg", bg = "$bg_d" },
NeoTreeTabInactive = { fg = "$grey", bg = "$black" }, NeoTreeTabInactive = { fg = "$grey", bg = "$black" },
NeoTreeTabSeparatorActive = { fg = "$black", bg = "$black" }, NeoTreeTabSeparatorActive = { fg = "$black", bg = "$black" },
NeoTreeTabSeparatorInactive = { fg = "$black", bg = "$black" }, NeoTreeTabSeparatorInactive = { fg = "$black", bg = "$black" },
NeoTreeWinSeparator = { fg = "$bg_d", bg = "$bg_d" }, NeoTreeWinSeparator = { fg = "$bg_d", bg = "$bg_d" },
NeoTreeVertSplit = { fg = "$bg_d", bg = "$bg_d" }, NeoTreeVertSplit = { fg = "$bg_d", bg = "$bg_d" },
VisualMultiMono = { fg = "$purple", bg = "$diff_change" }, VisualMultiMono = { fg = "$purple", bg = "$diff_change" },
VisualMultiExtend = { bg = "$diff_change" }, VisualMultiExtend = { bg = "$diff_change" },
VisualMultiCursor = { fg = "$purple", bg = "$diff_change" }, VisualMultiCursor = { fg = "$purple", bg = "$diff_change" },
VisualMultiInsert = { fg = "$blue", bg = "$diff_change" }, VisualMultiInsert = { fg = "$blue", bg = "$diff_change" },
}, },
} }
vim.g.VM_Mono_hl = "VisualMultiMono" vim.g.VM_Mono_hl = "VisualMultiMono"
vim.g.VM_Extend_hl = "VisualMultiExtend" vim.g.VM_Extend_hl = "VisualMultiExtend"
vim.g.VM_Cursor_hl = "VisualMultiCursor" vim.g.VM_Cursor_hl = "VisualMultiCursor"
vim.g.VM_Insert_hl = "VisualMultiInsert" vim.g.VM_Insert_hl = "VisualMultiInsert"
onedark.load() onedark.load()
''; '';
}; };
} }