From bccafb4bb100a051b09b6935578fd6c2d2708aa1 Mon Sep 17 00:00:00 2001 From: Natasha Moongrave Date: Wed, 4 Mar 2026 17:38:51 +0100 Subject: fixed keybinds and file tree config in neovim --- modules/home/i3wm/nord-blue/nvim.nix | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'modules/home/i3wm') diff --git a/modules/home/i3wm/nord-blue/nvim.nix b/modules/home/i3wm/nord-blue/nvim.nix index 2374041..c2b06e5 100644 --- a/modules/home/i3wm/nord-blue/nvim.nix +++ b/modules/home/i3wm/nord-blue/nvim.nix @@ -50,6 +50,7 @@ end, { desc = "Find files (cwd)" }) -- TAB KEYBINDS (t-based navigation) + -- Open in new tab with "t" in lua file tree vim.keymap.set("n", "t", function() local node = api.tree.get_node_under_cursor() @@ -115,7 +116,6 @@ vim.keymap.set("n", "fg", builtin.live_grep) vim.keymap.set("n", "fb", builtin.buffers) vim.keymap.set("n", "fh", builtin.help_tags) - -- File tree require("nvim-tree").setup({ view = { @@ -128,8 +128,32 @@ filters = { dotfiles = false, }, - }) + on_attach = function(bufnr) + local api = require("nvim-tree.api") + + local function opts(desc) + return { + desc = "nvim-tree: " .. desc, + buffer = bufnr, + noremap = true, + silent = true, + nowait = true, + } + end + + -- load default mappings first + api.config.mappings.default_on_attach(bufnr) + + -- open file in new tab with "t" + vim.keymap.set("n", "t", function() + local node = api.tree.get_node_under_cursor() + if node and node.type == "file" then + vim.cmd("tabnew " .. node.absolute_path) + end + end, opts("Open in new tab")) + end, + }) -- Keybind to toggle vim.keymap.set("n", "e", "NvimTreeToggle") -- cgit v1.2.3