From a0e50ce0e9802d0131f5b0794e6a66d7c40d6669 Mon Sep 17 00:00:00 2001 From: oddlama Date: Thu, 20 Jun 2024 17:44:41 +0200 Subject: [PATCH] chore: fix neovim completion shortcuts, address nix warnings --- users/myuser/neovim/completion.nix | 42 ++++++++++++------------------ users/myuser/neovim/languages.nix | 32 ++++++++++++----------- users/myuser/neovim/lsp.nix | 2 +- users/myuser/neovim/misc.nix | 4 +-- users/myuser/neovim/neo-tree.nix | 16 +++--------- users/myuser/neovim/onedark.nix | 4 +-- 6 files changed, 40 insertions(+), 60 deletions(-) diff --git a/users/myuser/neovim/completion.nix b/users/myuser/neovim/completion.nix index 18dc817..be96b24 100644 --- a/users/myuser/neovim/completion.nix +++ b/users/myuser/neovim/completion.nix @@ -36,9 +36,7 @@ ]; mapping = { "" = - /* - lua - */ + # lua '' cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, @@ -46,24 +44,16 @@ }) ''; "" = - /* - lua - */ + # lua "cmp.mapping.scroll_docs(-4)"; "" = - /* - lua - */ + # lua "cmp.mapping.scroll_docs(4)"; "" = - /* - lua - */ + # lua "cmp.mapping.abort()"; "" = - /* - lua - */ + # lua '' cmp.mapping(function(fallback) local has_words_before = function() @@ -77,17 +67,21 @@ require("luasnip").expand() elseif require("luasnip").expand_or_locally_jumpable() then require("luasnip").expand_or_jump() - elseif has_words_before() then - cmp.complete() + --elseif has_words_before() then + -- cmp.complete() else fallback() end end, {"i", "s"}) ''; + "" = + # lua + ''cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), {'i'})''; + "" = + # lua + ''cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), {'i'})''; "" = - /* - lua - */ + # lua '' cmp.mapping(function(fallback) if cmp.visible() then @@ -102,9 +96,7 @@ }; formatting.fields = ["abbr" "kind" "menu"]; formatting.format = - /* - lua - */ + # lua '' function(_, vim_item) local icons = { @@ -154,9 +146,7 @@ end ''; snippet.expand = - /* - lua - */ + # lua '' function(args) require('luasnip').lsp_expand(args.body) diff --git a/users/myuser/neovim/languages.nix b/users/myuser/neovim/languages.nix index 1c61fab..3d584fd 100644 --- a/users/myuser/neovim/languages.nix +++ b/users/myuser/neovim/languages.nix @@ -36,21 +36,23 @@ rustaceanvim = { enable = true; - server.settings.files.excludeDirs = [".direnv"]; - dap.autoloadConfigurations = true; - dap.adapter = let - code-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb; - in { - executable.command = "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb"; - executable.args = [ - "--liblldb" - "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/lldb/lib/liblldb.dylib" - "--port" - "31337" - ]; - type = "server"; - port = "31337"; - host = "127.0.0.1"; + settings = { + server.settings.files.excludeDirs = [".direnv"]; + dap.autoloadConfigurations = true; + dap.adapter = let + code-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb; + in { + executable.command = "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb"; + executable.args = [ + "--liblldb" + "${code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/lldb/lib/liblldb.dylib" + "--port" + "31337" + ]; + type = "server"; + port = "31337"; + host = "127.0.0.1"; + }; }; }; }; diff --git a/users/myuser/neovim/lsp.nix b/users/myuser/neovim/lsp.nix index 741bf20..7a42d15 100644 --- a/users/myuser/neovim/lsp.nix +++ b/users/myuser/neovim/lsp.nix @@ -35,7 +35,7 @@ cssls.enable = true; html.enable = true; # rust-analyzer should not be set here because of rustaceanvim - nil_ls = { + nil-ls = { enable = true; settings = { formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"]; diff --git a/users/myuser/neovim/misc.nix b/users/myuser/neovim/misc.nix index 91043a3..e8b1cfe 100644 --- a/users/myuser/neovim/misc.nix +++ b/users/myuser/neovim/misc.nix @@ -5,9 +5,7 @@ enable = true; stages = "static"; render.__raw = - /* - lua - */ + # lua ''"compact"''; icons = { debug = ""; diff --git a/users/myuser/neovim/neo-tree.nix b/users/myuser/neovim/neo-tree.nix index 2fe9617..19114ac 100644 --- a/users/myuser/neovim/neo-tree.nix +++ b/users/myuser/neovim/neo-tree.nix @@ -16,24 +16,16 @@ "z" = "close_all_nodes"; "Z" = "expand_all_nodes"; "a".__raw = - /* - lua - */ + # lua ''{ "add", config = { show_path = "relative" } }''; "A".__raw = - /* - lua - */ + # lua ''{ "add_directory", config = { show_path = "relative" } }''; "c".__raw = - /* - lua - */ + # lua ''{ "copy", config = { show_path = "relative" } }''; "m".__raw = - /* - lua - */ + # lua ''{ "move", config = { show_path = "relative" } }''; }; }; diff --git a/users/myuser/neovim/onedark.nix b/users/myuser/neovim/onedark.nix index ed53a6e..01771bc 100644 --- a/users/myuser/neovim/onedark.nix +++ b/users/myuser/neovim/onedark.nix @@ -11,9 +11,7 @@ extraConfigLua = lib.mkBefore - /* - lua - */ + # lua '' local onedark = require "onedark" onedark.setup {