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,8 +20,9 @@
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;
settings = {
sources = [ sources = [
{name = "nvim_lsp_signature_help";} {name = "nvim_lsp_signature_help";}
{name = "nvim_lsp";} {name = "nvim_lsp";}
@ -31,21 +32,38 @@
{name = "luasnip";} {name = "luasnip";}
{name = "emoji";} {name = "emoji";}
]; ];
mappingPresets = ["insert"];
mapping = { mapping = {
"<CR>" = '' "<CR>" =
/*
lua
*/
''
cmp.mapping.confirm({ cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
}) })
''; '';
"<C-d>" = "cmp.mapping.scroll_docs(-4)"; "<C-d>" =
"<C-f>" = "cmp.mapping.scroll_docs(4)"; /*
"<C-e>" = "cmp.mapping.abort()"; lua
"<Tab>" = { */
modes = ["i" "s"]; "cmp.mapping.scroll_docs(-4)";
action = '' "<C-f>" =
function(fallback) /*
lua
*/
"cmp.mapping.scroll_docs(4)";
"<C-e>" =
/*
lua
*/
"cmp.mapping.abort()";
"<Tab>" =
/*
lua
*/
''
cmp.mapping(function(fallback)
local has_words_before = function() local has_words_before = function()
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0)) 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 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
@ -62,13 +80,14 @@
else else
fallback() fallback()
end end
end end, {"i", "s"})
''; '';
}; "<S-Tab>" =
"<S-Tab>" = { /*
modes = ["i" "s"]; lua
action = '' */
function(fallback) ''
cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
@ -76,12 +95,15 @@
else else
fallback() fallback()
end end
end end, {"i", "s"})
''; '';
}; };
};
formatting.fields = ["abbr" "kind" "menu"]; formatting.fields = ["abbr" "kind" "menu"];
formatting.format = '' formatting.format =
/*
lua
*/
''
function(_, vim_item) function(_, vim_item)
local icons = { local icons = {
Namespace = "󰌗", Namespace = "󰌗",
@ -129,7 +151,16 @@
return vim_item return vim_item
end end
''; '';
snippet.expand = "luasnip"; snippet.expand =
/*
lua
*/
''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
};
}; };
# TODO use "ray-x/lsp_signature.nvim" # TODO use "ray-x/lsp_signature.nvim"

View file

@ -51,7 +51,11 @@
{ {
event = ["BufEnter" "BufWinEnter"]; event = ["BufEnter" "BufWinEnter"];
pattern = ["term://*"]; pattern = ["term://*"];
callback.__raw = '' callback.__raw =
/*
lua
*/
''
function() function()
vim.bo.number = false vim.bo.number = false
end end
@ -60,7 +64,11 @@
{ {
event = ["WinEnter"]; event = ["WinEnter"];
pattern = ["*"]; pattern = ["*"];
callback.__raw = '' callback.__raw =
/*
lua
*/
''
function() function()
pcall(function() pcall(function()
if vim.bo.buftype == "nofile" or vim.bo.buftype == "help" then if vim.bo.buftype == "nofile" or vim.bo.buftype == "help" then

View file

@ -6,7 +6,11 @@
programs.nixvim.plugins = { programs.nixvim.plugins = {
lsp = { lsp = {
enable = true; enable = true;
preConfig = '' preConfig =
/*
lua
*/
''
local lsp_symbol = function(name, icon) local lsp_symbol = function(name, icon)
vim.fn.sign_define( vim.fn.sign_define(
"DiagnosticSign" .. name, "DiagnosticSign" .. name,

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,14 +72,22 @@
vim-startuptime vim-startuptime
]; ];
extraConfigLuaPre = '' extraConfigLuaPre =
/*
lua
*/
''
vim.g.operator_sandwich_no_default_key_mappings = 1 vim.g.operator_sandwich_no_default_key_mappings = 1
vim.g.textobj_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 =
/*
lua
*/
''
require("window-picker").setup { require("window-picker").setup {
hint = "floating-big-letter", hint = "floating-big-letter",
filter_rules = { filter_rules = {

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,7 +9,12 @@
onedark-nvim onedark-nvim
]; ];
extraConfigLua = lib.mkBefore '' extraConfigLua =
lib.mkBefore
/*
lua
*/
''
local onedark = require "onedark" local onedark = require "onedark"
onedark.setup { onedark.setup {
toggle_style_key = "<nop>", toggle_style_key = "<nop>",