From 06722274f983c0bb5cbbda495699e601e492846b Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Sun, 14 Jan 2024 10:55:13 +0100 Subject: [PATCH] Nvim: More configs --- ...spconfig.lua => nvim-lspconfig-config.lua} | 0 modules/hm/nvim/telescope-config.lua | 24 +++++++ modules/hm/vim.nix | 63 ++++++------------- 3 files changed, 42 insertions(+), 45 deletions(-) rename modules/hm/nvim/{nvim-lspconfig.lua => nvim-lspconfig-config.lua} (100%) create mode 100644 modules/hm/nvim/telescope-config.lua diff --git a/modules/hm/nvim/nvim-lspconfig.lua b/modules/hm/nvim/nvim-lspconfig-config.lua similarity index 100% rename from modules/hm/nvim/nvim-lspconfig.lua rename to modules/hm/nvim/nvim-lspconfig-config.lua diff --git a/modules/hm/nvim/telescope-config.lua b/modules/hm/nvim/telescope-config.lua new file mode 100644 index 0000000..fa8fe08 --- /dev/null +++ b/modules/hm/nvim/telescope-config.lua @@ -0,0 +1,24 @@ +local telescope = require("telescope") +local actions = require("telescope.actions") + +telescope.setup({ + defaults = { + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + actions.open_qflist, + } + } + } +}) + +telescope.load_extension("fzf"); + +local keymap = vim.keymap + +keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) +keymap.set("n", "fr", "Telescope oldfiles", { desc = "Fuzzy find recent files" }) +keymap.set("n", "fs", "Telescope live_grep", { desc = "Find string in cwd" }) +keymap.set("n", "fc", "Telescope grep_string", { desc = "Fuzzy string under cursor in cwd" }) + diff --git a/modules/hm/vim.nix b/modules/hm/vim.nix index 03b66df..67f3cb2 100644 --- a/modules/hm/vim.nix +++ b/modules/hm/vim.nix @@ -22,40 +22,25 @@ let vp = pkgs.vimPlugins; in { { plugin = vp.telescope-nvim; type = "lua"; - config = '' - local telescope = require("telescope") - local actions = require("telescope.actions") - - telescope.setup({ - defaults = { - mappings = { - i = { - [""] = actions.move_selection_previous, -- move to prev result - [""] = actions.move_selection_next, -- move to next result - [""] = actions.send_selected_to_qflist + actions.open_qflist, - } - } - } - }) - - telescope.load_extension("fzf"); - - local keymap = vim.keymap - - keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) - keymap.set("n", "fr", "Telescope oldfiles", { desc = "Fuzzy find recent files" }) - keymap.set("n", "fs", "Telescope live_grep", { desc = "Find string in cwd" }) - keymap.set("n", "fc", "Telescope grep_string", { desc = "Fuzzy string under cursor in cwd" }) - ''; + config = builtins.readFile ./nvim/telescope-config.lua; } - vp.dressing-nvim # Better UI for input and selection + # Better UI for input and selection + vp.dressing-nvim # Tree view - # vp.nerdtree-git-plugin - # vp.vim-devicons - # vp.nerdtree - # vp.chadtree + { + plugin = vp.chadtree; + type = "lua"; + config = '' + local chadtree = require("chadtree") + + local chadtree_settings = { } + vim.api.nvim_set_var("chadtree_settings", chadtree_settings) + + vim.keymap.set({ "n", "v" }, "v", "CHADopen", { desc = "Toggle file tree" }) + ''; + } vp.cmp-buffer # source for text in buffer vp.cmp-path # source for file system path @@ -71,30 +56,18 @@ let vp = pkgs.vimPlugins; in { # # Detect tabstop and shiftwidth automatically # vp.sleuth - # { - # plugin = vp.nvim-cmp; - # type = "lua"; - # config = '' - # require() - # ''; - # } - - # # LSP + # LSP # fidget moving while LSP is working { plugin = vp.fidget-nvim; type = "lua"; - config = '' - require("fidget").setup({}) - ''; + config = ''require("fidget").setup({})''; } - # vp.neodev-nvim - # # vp.nvim-lspconfig vp.cmp-nvim-lsp { plugin = vp.nvim-lspconfig; type = "lua"; - config = builtins.readFile ./nvim/nvim-lspconfig.lua; + config = builtins.readFile ./nvim/nvim-lspconfig-config.lua; } # # Autocompletion