diff --git a/homeManagerModules/neovim/default.nix b/homeManagerModules/neovim/default.nix index 3645cafe..7178b552 100644 --- a/homeManagerModules/neovim/default.nix +++ b/homeManagerModules/neovim/default.nix @@ -46,8 +46,8 @@ in { -- remove highlight on words vim.keymap.set('n', '', ':noh', { - noremap = true, - silent = true, + noremap = true, + silent = true, }); -- Get rid of deprecated messages diff --git a/homeManagerModules/neovim/langs/bash.nix b/homeManagerModules/neovim/langs/bash.nix index 77201e98..5c12e4c3 100644 --- a/homeManagerModules/neovim/langs/bash.nix +++ b/homeManagerModules/neovim/langs/bash.nix @@ -4,7 +4,7 @@ pkgs, ... }: let - inherit (lib) getExe mkIf; + inherit (lib) attrValues getExe mkIf; cfg = config.programs.neovim; in { @@ -20,22 +20,31 @@ in { viAlias = true; vimAlias = true; - extraPackages = mkIf cfg.enableIde [ - pkgs.nodePackages.bash-language-server - pkgs.shellcheck - ]; + extraPackages = mkIf cfg.enableIde (attrValues { + inherit + (pkgs.nodePackages) + bash-language-server + ; + + inherit + (pkgs) + shellcheck + ; + }); extraLuaConfig = mkIf cfg.enableIde # lua '' + local default_capabilities = require('cmp_nvim_lsp').default_capabilities(); + vim.api.nvim_create_autocmd('FileType', { pattern = 'sh', command = 'setlocal ts=4 sw=4 sts=0 expandtab', }); require('lspconfig').bashls.setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities(), + capabilities = default_capabilities, settings = { bashIde = { diff --git a/homeManagerModules/neovim/langs/clang.nix b/homeManagerModules/neovim/langs/clang.nix index 6f8186f9..91d311b6 100644 --- a/homeManagerModules/neovim/langs/clang.nix +++ b/homeManagerModules/neovim/langs/clang.nix @@ -4,7 +4,7 @@ pkgs, ... }: let - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; inherit (pkgs.writers) writeYAML; cfg = config.programs.neovim; @@ -16,7 +16,7 @@ in programs = { neovim = { - extraPackages = builtins.attrValues { + extraPackages = attrValues { inherit (pkgs) gcc @@ -29,29 +29,35 @@ in # lua '' vim.api.nvim_create_autocmd('FileType', { - pattern = { 'cpp' , 'c'}, + pattern = { 'cpp', 'c' }, command = 'setlocal ts=4 sw=4 sts=0 expandtab', }); local lsp = require('lspconfig'); + local default_capabilities = require('cmp_nvim_lsp').default_capabilities(); + local clangd_extensions = require('clangd_extensions.inlay_hints'); lsp.cmake.setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities(), + capabilities = default_capabilities, }); lsp.clangd.setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities(), + capabilities = default_capabilities, handlers = require('lsp-status').extensions.clangd.setup(), + on_attach = function(_, bufnr) - require("clangd_extensions.inlay_hints").setup_autocmd() - require("clangd_extensions.inlay_hints").set_inlay_hints() + clangd_extensions.setup_autocmd(); + clangd_extensions.set_inlay_hints(); end, }); ''; - plugins = builtins.attrValues { - inherit (pkgs.vimPlugins) clangd_extensions-nvim; + plugins = attrValues { + inherit + (pkgs.vimPlugins) + clangd_extensions-nvim + ; }; }; }; diff --git a/homeManagerModules/neovim/langs/csharp.nix b/homeManagerModules/neovim/langs/csharp.nix index 240167d5..4f71f23f 100644 --- a/homeManagerModules/neovim/langs/csharp.nix +++ b/homeManagerModules/neovim/langs/csharp.nix @@ -4,14 +4,14 @@ pkgs, ... }: let - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; cfg = config.programs.neovim; in mkIf cfg.enableIde { programs = { neovim = { - extraPackages = builtins.attrValues { + extraPackages = attrValues { inherit (pkgs) omnisharp-roslyn @@ -29,13 +29,13 @@ in local omnisharp_extended = require('omnisharp_extended'); require('lspconfig').omnisharp.setup({ - cmd = { "dotnet", "${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll" }, + cmd = { 'dotnet', '${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll' }, handlers = { - ["textDocument/definition"] = omnisharp_extended.definition_handler, - ["textDocument/typeDefinition"] = omnisharp_extended.type_definition_handler, - ["textDocument/references"] = omnisharp_extended.references_handler, - ["textDocument/implementation"] = omnisharp_extended.implementation_handler, + ['textDocument/definition'] = omnisharp_extended.definition_handler, + ['textDocument/typeDefinition'] = omnisharp_extended.type_definition_handler, + ['textDocument/references'] = omnisharp_extended.references_handler, + ['textDocument/implementation'] = omnisharp_extended.implementation_handler, }, settings = { @@ -59,8 +59,11 @@ in }); ''; - plugins = builtins.attrValues { - inherit (pkgs.vimPlugins) omnisharp-extended-lsp-nvim; + plugins = attrValues { + inherit + (pkgs.vimPlugins) + omnisharp-extended-lsp-nvim + ; }; }; }; diff --git a/homeManagerModules/neovim/langs/default.nix b/homeManagerModules/neovim/langs/default.nix index 43f58ebf..03206f39 100644 --- a/homeManagerModules/neovim/langs/default.nix +++ b/homeManagerModules/neovim/langs/default.nix @@ -18,6 +18,7 @@ in { ./lua.nix ./python.nix ./rust.nix + (import ./markdown.nix self) (import ./nix.nix self) (import ./web.nix self) diff --git a/homeManagerModules/neovim/langs/hyprlang.nix b/homeManagerModules/neovim/langs/hyprlang.nix index 582ce17a..a12c6013 100644 --- a/homeManagerModules/neovim/langs/hyprlang.nix +++ b/homeManagerModules/neovim/langs/hyprlang.nix @@ -14,7 +14,7 @@ in # lua '' vim.filetype.add({ - pattern = { ['.*/hypr/.*%.conf'] = 'hyprlang' }, + pattern = { [ '.*/hypr/.*%.conf' ] = 'hyprlang' }, }); vim.api.nvim_create_autocmd('FileType', { diff --git a/homeManagerModules/neovim/langs/java.nix b/homeManagerModules/neovim/langs/java.nix index a65656dd..ff9c8291 100644 --- a/homeManagerModules/neovim/langs/java.nix +++ b/homeManagerModules/neovim/langs/java.nix @@ -4,12 +4,12 @@ pkgs, ... }: let - inherit (lib) getExe mkIf; + inherit (lib) attrValues getExe mkIf; cfg = config.programs.neovim; javaSdk = pkgs.temurin-bin-17; - javaPkgs = builtins.attrValues {inherit (pkgs) gradle maven;}; + javaPkgs = attrValues {inherit (pkgs) gradle maven;}; in mkIf cfg.enableIde { home.packages = javaPkgs; diff --git a/homeManagerModules/neovim/langs/json.nix b/homeManagerModules/neovim/langs/json.nix index 93fe1545..39ea78e3 100644 --- a/homeManagerModules/neovim/langs/json.nix +++ b/homeManagerModules/neovim/langs/json.nix @@ -4,14 +4,14 @@ pkgs, ... }: let - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; cfg = config.programs.neovim; in mkIf cfg.enableIde { programs = { neovim = { - extraPackages = builtins.attrValues { + extraPackages = attrValues { inherit (pkgs) vscode-langservers-extracted @@ -32,13 +32,14 @@ in }); local lsp = require('lspconfig'); + local default_capabilities = require('cmp_nvim_lsp').default_capabilities(); lsp.jsonls.setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities(), + capabilities = default_capabilities, }); lsp.yamlls.setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities(), + capabilities = default_capabilities, settings = { yaml = { diff --git a/homeManagerModules/neovim/langs/lua.nix b/homeManagerModules/neovim/langs/lua.nix index 943364e8..ff6371b6 100644 --- a/homeManagerModules/neovim/langs/lua.nix +++ b/homeManagerModules/neovim/langs/lua.nix @@ -4,7 +4,7 @@ pkgs, ... }: let - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; cfg = config.programs.neovim; @@ -13,8 +13,11 @@ in mkIf cfg.enableIde { programs = { neovim = { - extraPackages = builtins.attrValues { - inherit (pkgs) lua-language-server; + extraPackages = attrValues { + inherit + (pkgs) + lua-language-server + ; }; plugins = [ @@ -24,6 +27,8 @@ in config = # lua '' + local default_capabilities = require('cmp_nvim_lsp').default_capabilities(); + vim.api.nvim_create_autocmd('FileType', { pattern = 'lua', command = 'setlocal ts=4 sw=4 sts=0 expandtab', @@ -40,7 +45,7 @@ in }); require('lspconfig').lua_ls.setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities(), + capabilities = default_capabilities, }); ''; } diff --git a/homeManagerModules/neovim/langs/markdown.nix b/homeManagerModules/neovim/langs/markdown.nix index e3f83177..bc0ab830 100644 --- a/homeManagerModules/neovim/langs/markdown.nix +++ b/homeManagerModules/neovim/langs/markdown.nix @@ -8,14 +8,14 @@ self: { inherit (self.inputs) vimplugin-easytables-src; inherit (self.lib.${pkgs.system}) buildPlugin; - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; cfg = config.programs.neovim; in { config = mkIf cfg.enableIde { programs = { neovim = { - extraPackages = builtins.attrValues { + extraPackages = attrValues { inherit (pkgs) pandoc diff --git a/homeManagerModules/neovim/langs/nix.nix b/homeManagerModules/neovim/langs/nix.nix index 19a07da4..bdf2f508 100644 --- a/homeManagerModules/neovim/langs/nix.nix +++ b/homeManagerModules/neovim/langs/nix.nix @@ -5,7 +5,8 @@ self: { pkgs, ... }: let - inherit (lib) getExe hasPrefix mkIf removePrefix; + inherit (builtins) toJSON; + inherit (lib) attrValues getExe hasPrefix mkIf removePrefix; inherit (osConfig.networking) hostName; cfg = config.programs.neovim; @@ -31,15 +32,17 @@ in { } ]; - home.packages = [ - defaultFormatter - nixdPkg - ]; + home.packages = attrValues { + inherit + defaultFormatter + nixdPkg + ; + }; # nixd by default kinda spams LspLog home.sessionVariables.NIXD_FLAGS = "-log=error"; - xdg.dataFile."${flakeDir}/.nixd.json".text = builtins.toJSON { + xdg.dataFile."${flakeDir}/.nixd.json".text = toJSON { nixpkgs = { expr = "import (builtins.getFlake \"${flakeDir}\").inputs.nixpkgs {}"; }; @@ -50,9 +53,9 @@ in { programs = { neovim = { - extraPackages = [ - nixdPkg - ]; + extraPackages = attrValues { + inherit nixdPkg; + }; extraLuaConfig = # lua diff --git a/homeManagerModules/neovim/langs/python.nix b/homeManagerModules/neovim/langs/python.nix index 4484d282..42b04114 100644 --- a/homeManagerModules/neovim/langs/python.nix +++ b/homeManagerModules/neovim/langs/python.nix @@ -4,31 +4,33 @@ pkgs, ... }: let - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; cfg = config.programs.neovim; -in - mkIf cfg.enableIde { +in { + config = mkIf cfg.enableIde { programs = { neovim = { withPython3 = true; extraPython3Packages = py: - with py; ([ - python-lsp-server - ] - ++ python-lsp-server.optional-dependencies.all); + (attrValues { + inherit (py) python-lsp-server; + }) + ++ py.python-lsp-server.optional-dependencies.all; - extraPackages = with pkgs.python3Packages; ([ - python-lsp-server - ] - ++ python-lsp-server.optional-dependencies.all); + extraPackages = + (attrValues { + inherit (pkgs.python3Packages) python-lsp-server; + }) + ++ pkgs.python3Packages.python-lsp-server.optional-dependencies.all; extraLuaConfig = # lua '' require('lspconfig').pylsp.setup({ capabilities = require('cmp_nvim_lsp').default_capabilities(), + settings = { pylsp = { plugins = { @@ -42,4 +44,5 @@ in ''; }; }; - } + }; +} diff --git a/homeManagerModules/neovim/langs/web.nix b/homeManagerModules/neovim/langs/web.nix index fbd67e54..fc033030 100644 --- a/homeManagerModules/neovim/langs/web.nix +++ b/homeManagerModules/neovim/langs/web.nix @@ -7,7 +7,7 @@ self: { inherit (self.inputs) vimplugin-ts-error-translator-src; inherit (self.lib.${pkgs.system}) buildPlugin; - inherit (lib) mkIf; + inherit (lib) attrValues mkIf; cfg = config.programs.neovim; in { @@ -16,7 +16,7 @@ in { neovim = { withNodeJs = true; - extraPackages = builtins.attrValues { + extraPackages = attrValues { inherit (pkgs) neovim-node-client @@ -114,7 +114,7 @@ in { mode = 'location', }, options = { - flags = {'unstable_ts_config'}, + flags = { 'unstable_ts_config' }, }, }, });