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

View file

@ -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"

View file

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

View file

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

View file

@ -4,7 +4,11 @@
notify = {
enable = true;
stages = "static";
render.__raw = ''"compact"'';
render.__raw =
/*
lua
*/
''"compact"'';
icons = {
debug = "";
error = "󰅙";
@ -68,39 +72,47 @@
vim-startuptime
];
extraConfigLuaPre = ''
vim.g.operator_sandwich_no_default_key_mappings = 1
vim.g.textobj_sandwich_no_default_key_mappings = 1
extraConfigLuaPre =
/*
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 = ''
require("window-picker").setup {
hint = "floating-big-letter",
filter_rules = {
bo = {
filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" },
buftype = { "terminal", "quickfix", "prompt" },
extraConfigLuaPost =
/*
lua
*/
''
require("window-picker").setup {
hint = "floating-big-letter",
filter_rules = {
bo = {
filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" },
buftype = { "terminal", "quickfix", "prompt" },
},
},
},
floating_big_letter = {
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,
floating_big_letter = {
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,
},
},
}
'';
};
}

View file

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

View file

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