aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/editor/neovim
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tools/editor/neovim')
-rw-r--r--modules/tools/editor/neovim/config/keybindings.lua3
-rw-r--r--modules/tools/editor/neovim/config/options.lua16
-rw-r--r--modules/tools/editor/neovim/plugins/config/default.nix1
-rw-r--r--modules/tools/editor/neovim/plugins/config/dressing.lua1
-rw-r--r--modules/tools/editor/neovim/plugins/config/lsp-config.lua17
-rw-r--r--modules/tools/editor/neovim/plugins/config/nvim-tree.lua2
-rw-r--r--modules/tools/editor/neovim/plugins/default.nix2
7 files changed, 23 insertions, 19 deletions
diff --git a/modules/tools/editor/neovim/config/keybindings.lua b/modules/tools/editor/neovim/config/keybindings.lua
index 3e8e0fa..3f2c9bf 100644
--- a/modules/tools/editor/neovim/config/keybindings.lua
+++ b/modules/tools/editor/neovim/config/keybindings.lua
@@ -3,6 +3,3 @@ vim.keymap.set("n", "<C-h>", ":wincmd h<CR>", { silent = true });
vim.keymap.set("n", "<C-j>", ":wincmd j<CR>", { silent = true });
vim.keymap.set("n", "<C-k>", ":wincmd k<CR>", { silent = true });
vim.keymap.set("n", "<C-l>", ":wincmd l<CR>", { silent = true });
-
--- NvimTree
-vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true });
diff --git a/modules/tools/editor/neovim/config/options.lua b/modules/tools/editor/neovim/config/options.lua
index 450e613..bd475c7 100644
--- a/modules/tools/editor/neovim/config/options.lua
+++ b/modules/tools/editor/neovim/config/options.lua
@@ -31,11 +31,11 @@ vim.api.nvim_create_autocmd("FileType", {
});
-- Exception that use spaces
--- vim.api.nvim_create_autocmd("FileType", {
--- pattern = {},
--- callback = function()
--- vim.bo.expandtab = true;
--- vim.bo.tabstop = 2;
--- vim.bo.shiftwidth = 2;
--- end,
--- });
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "yaml" },
+ callback = function()
+ vim.bo.expandtab = true;
+ vim.bo.tabstop = 2;
+ vim.bo.shiftwidth = 2;
+ end,
+});
diff --git a/modules/tools/editor/neovim/plugins/config/default.nix b/modules/tools/editor/neovim/plugins/config/default.nix
index 6dff0b9..81407d7 100644
--- a/modules/tools/editor/neovim/plugins/config/default.nix
+++ b/modules/tools/editor/neovim/plugins/config/default.nix
@@ -4,6 +4,7 @@ let
extra = if config.tools.editor.neovim.configuration == "full" then
''
${builtins.readFile ./lsp-config.lua}
+${builtins.readFile ./dressing.lua}
${builtins.readFile (config.scheme {
template = builtins.readFile ./noice.mustache.lua;
})}
diff --git a/modules/tools/editor/neovim/plugins/config/dressing.lua b/modules/tools/editor/neovim/plugins/config/dressing.lua
new file mode 100644
index 0000000..6d14d47
--- /dev/null
+++ b/modules/tools/editor/neovim/plugins/config/dressing.lua
@@ -0,0 +1 @@
+require("dressing").setup();
diff --git a/modules/tools/editor/neovim/plugins/config/lsp-config.lua b/modules/tools/editor/neovim/plugins/config/lsp-config.lua
index 88f063d..d440c67 100644
--- a/modules/tools/editor/neovim/plugins/config/lsp-config.lua
+++ b/modules/tools/editor/neovim/plugins/config/lsp-config.lua
@@ -45,23 +45,24 @@ local lsp_setup_done = {};
-- Function to setup LSP based on filetype
local function setup_lsp(filetype)
local lsp = filetype_to_lsp[filetype];
- if lsp and not lsp_setup_done[lsp.server] then
+ if lsp ~= nil and not lsp_setup_done[lsp.server] then
lsp_setup_done[lsp.server] = true;
- if vim.fn.executable(lsp.executable) then
+ if vim.fn.executable(lsp.executable) == 1 then
lspconfig[lsp.server].setup({});
- vim.lsp.start();
end
end
end
-vim.keymap.set("n", "gd", vim.lsp.buf.definition, { noremap = true, silent = true });
-vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { noremap = true, silent = true });
-vim.keymap.set("n", "gr", vim.lsp.buf.references, { noremap = true, silent = true });
-vim.keymap.set("n", "gk", vim.lsp.buf.hover, { noremap = true, silent = true });
-
vim.api.nvim_create_autocmd("FileType", {
pattern = "*", -- Match all file types
callback = function()
setup_lsp(vim.bo.filetype); -- Call the setup_lsp function only if the filetype is in the mapping
end,
});
+
+local lsp_keymap_opts = { noremap = true, silent = true };
+
+vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, lsp_keymap_opts);
+vim.keymap.set("n", "<leader>i", vim.lsp.buf.implementation, lsp_keymap_opts);
+vim.keymap.set("n", "<leader>r", vim.lsp.buf.references, lsp_keymap_opts);
+vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, lsp_keymap_opts);
diff --git a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua b/modules/tools/editor/neovim/plugins/config/nvim-tree.lua
index c6c4102..cdbef6a 100644
--- a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua
+++ b/modules/tools/editor/neovim/plugins/config/nvim-tree.lua
@@ -11,3 +11,5 @@ require("nvim-tree").setup {
end,
},
};
+
+vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true });
diff --git a/modules/tools/editor/neovim/plugins/default.nix b/modules/tools/editor/neovim/plugins/default.nix
index d2a58b1..61c046c 100644
--- a/modules/tools/editor/neovim/plugins/default.nix
+++ b/modules/tools/editor/neovim/plugins/default.nix
@@ -10,6 +10,7 @@
nvim-treesitter
nvim-web-devicons
nvim-tree-lua
+ which-key-nvim
(base16-vim.overrideAttrs (old: {
patchPhase = "ln -s ${config.scheme base16-vim} colors/base16-scheme.vim";
}))
@@ -17,6 +18,7 @@
(if config.tools.editor.neovim.configuration == "full" then
[
noice-nvim
+ dressing-nvim
nvim-lspconfig
]
else null)