diff --git a/config/lsp/default.nix b/config/lsp/default.nix index f401b06..5ea86d0 100644 --- a/config/lsp/default.nix +++ b/config/lsp/default.nix @@ -3,5 +3,6 @@ ./lsp.nix ./lsp-format.nix ./lspkind.nix + ./nvim-metals.nix ]; } diff --git a/config/lsp/lsp.nix b/config/lsp/lsp.nix index 4af99ad..1b2061d 100644 --- a/config/lsp/lsp.nix +++ b/config/lsp/lsp.nix @@ -1,4 +1,4 @@ -{ ... }: +{ helpers, ... }: { plugins.lsp = { @@ -16,9 +16,6 @@ nixd = { enable = true; }; - metals = { - enable = true; - }; }; inlayHints = true; keymaps = { @@ -73,4 +70,19 @@ }; }; }; + + keymaps = [ + { + mode = [ "n" ]; + key = "th"; + action = helpers.mkRaw '' + function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end + ''; + options = { + desc = "Toggle inlay hints"; + }; + } + ]; } diff --git a/config/lsp/nvim-metals.nix b/config/lsp/nvim-metals.nix new file mode 100644 index 0000000..83b4a70 --- /dev/null +++ b/config/lsp/nvim-metals.nix @@ -0,0 +1,41 @@ +{ pkgs, helpers, ... }: + +{ + extraPlugins = [ + pkgs.vimPlugins.nvim-metals + pkgs.vimPlugins.plenary-nvim + ]; + + extraPackages = [ + pkgs.metals + ]; + + autoGroups.nvim_metals_group = { + clear = true; + }; + + autoCmd = [ + { + event = "FileType"; + group = "nvim_metals_group"; + desc = "Initialize nvim-metals"; + callback = helpers.mkRaw '' + function() + metals_config = require("metals").bare_config() + metals_config.init_options.statusBarProvider = "off" + metals_config.settings = { + showInferredType = true, + showImplicitArguments = false, + showImplicitConversionsAndClasses = false, + metalsBinaryPath = "${pkgs.lib.getExe pkgs.metals}", + useGlobalExecutable = true + } + vim.lsp.inlay_hint.enable(true) + require("metals").initialize_or_attach(metals_config) + end + ''; + } + ]; + + plugins.fidget.enable = true; +} diff --git a/config/neo-tree.nix b/config/neo-tree.nix index 8df05c3..cd3132c 100644 --- a/config/neo-tree.nix +++ b/config/neo-tree.nix @@ -25,7 +25,6 @@ end end ''; - window.mappings."s" = ""; window.mappings."" = ""; }; keymaps = [ diff --git a/config/project.nix b/config/project.nix index b411ec7..3930ecf 100644 --- a/config/project.nix +++ b/config/project.nix @@ -1,6 +1,27 @@ +{ helpers, ... }: + { plugins.project-nvim = { enable = true; enableTelescope = true; + silentChdir = false; + scopeChdir = "tab"; }; + + autoGroups.project_nvim_group = { + clear = true; + }; + + autoCmd = [ + { + event = "VimEnter"; + group = "project_nvim_group"; + desc = "Startup with project.nvim"; + callback = helpers.mkRaw '' + function() + require("telescope").extensions.projects.projects{} + end + ''; + } + ]; } diff --git a/config/telescope.nix b/config/telescope.nix index aa08b59..c394c3d 100644 --- a/config/telescope.nix +++ b/config/telescope.nix @@ -17,5 +17,14 @@ desc = "Find files with telescope"; }; } + { + mode = [ "n" "i" ]; + key = ""; + action = helpers.mkRaw '' + function() + require("telescope.builtin").help_tags() + end + ''; + } ]; }