chore: fix neovim completion shortcuts, address nix warnings

This commit is contained in:
oddlama 2024-06-20 17:44:41 +02:00
parent 0349d7fd8b
commit a0e50ce0e9
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
6 changed files with 40 additions and 60 deletions

View file

@ -36,9 +36,7 @@
]; ];
mapping = { mapping = {
"<CR>" = "<CR>" =
/* # lua
lua
*/
'' ''
cmp.mapping.confirm({ cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
@ -46,24 +44,16 @@
}) })
''; '';
"<C-d>" = "<C-d>" =
/* # lua
lua
*/
"cmp.mapping.scroll_docs(-4)"; "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "<C-f>" =
/* # lua
lua
*/
"cmp.mapping.scroll_docs(4)"; "cmp.mapping.scroll_docs(4)";
"<C-e>" = "<C-e>" =
/* # lua
lua
*/
"cmp.mapping.abort()"; "cmp.mapping.abort()";
"<Tab>" = "<Tab>" =
/* # lua
lua
*/
'' ''
cmp.mapping(function(fallback) cmp.mapping(function(fallback)
local has_words_before = function() local has_words_before = function()
@ -77,17 +67,21 @@
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"}) end, {"i", "s"})
''; '';
"<Down>" =
# lua
''cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), {'i'})'';
"<Up>" =
# lua
''cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), {'i'})'';
"<S-Tab>" = "<S-Tab>" =
/* # lua
lua
*/
'' ''
cmp.mapping(function(fallback) cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
@ -102,9 +96,7 @@
}; };
formatting.fields = ["abbr" "kind" "menu"]; formatting.fields = ["abbr" "kind" "menu"];
formatting.format = formatting.format =
/* # lua
lua
*/
'' ''
function(_, vim_item) function(_, vim_item)
local icons = { local icons = {
@ -154,9 +146,7 @@
end end
''; '';
snippet.expand = snippet.expand =
/* # lua
lua
*/
'' ''
function(args) function(args)
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)

View file

@ -36,21 +36,23 @@
rustaceanvim = { rustaceanvim = {
enable = true; enable = true;
server.settings.files.excludeDirs = [".direnv"]; settings = {
dap.autoloadConfigurations = true; server.settings.files.excludeDirs = [".direnv"];
dap.adapter = let dap.autoloadConfigurations = true;
code-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb; dap.adapter = let
in { code-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb;
executable.command = "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb"; in {
executable.args = [ executable.command = "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
"--liblldb" executable.args = [
"${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/lldb/lib/liblldb.dylib" "--liblldb"
"--port" "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/lldb/lib/liblldb.dylib"
"31337" "--port"
]; "31337"
type = "server"; ];
port = "31337"; type = "server";
host = "127.0.0.1"; port = "31337";
host = "127.0.0.1";
};
}; };
}; };
}; };

View file

@ -35,7 +35,7 @@
cssls.enable = true; cssls.enable = true;
html.enable = true; html.enable = true;
# rust-analyzer should not be set here because of rustaceanvim # rust-analyzer should not be set here because of rustaceanvim
nil_ls = { nil-ls = {
enable = true; enable = true;
settings = { settings = {
formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"]; formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"];

View file

@ -5,9 +5,7 @@
enable = true; enable = true;
stages = "static"; stages = "static";
render.__raw = render.__raw =
/* # lua
lua
*/
''"compact"''; ''"compact"'';
icons = { icons = {
debug = ""; debug = "";

View file

@ -16,24 +16,16 @@
"z" = "close_all_nodes"; "z" = "close_all_nodes";
"Z" = "expand_all_nodes"; "Z" = "expand_all_nodes";
"a".__raw = "a".__raw =
/* # lua
lua
*/
''{ "add", config = { show_path = "relative" } }''; ''{ "add", config = { show_path = "relative" } }'';
"A".__raw = "A".__raw =
/* # lua
lua
*/
''{ "add_directory", config = { show_path = "relative" } }''; ''{ "add_directory", config = { show_path = "relative" } }'';
"c".__raw = "c".__raw =
/* # lua
lua
*/
''{ "copy", config = { show_path = "relative" } }''; ''{ "copy", config = { show_path = "relative" } }'';
"m".__raw = "m".__raw =
/* # lua
lua
*/
''{ "move", config = { show_path = "relative" } }''; ''{ "move", config = { show_path = "relative" } }'';
}; };
}; };

View file

@ -11,9 +11,7 @@
extraConfigLua = extraConfigLua =
lib.mkBefore lib.mkBefore
/* # lua
lua
*/
'' ''
local onedark = require "onedark" local onedark = require "onedark"
onedark.setup { onedark.setup {