diff --git a/flake.lock b/flake.lock index bee2683..341df55 100644 --- a/flake.lock +++ b/flake.lock @@ -437,7 +437,8 @@ "nix-darwin": "nix-darwin", "nixos-hardware": "nixos-hardware", "nixpkgs-unstable": "nixpkgs-unstable", - "vimPlugin-auto-dark-mode": "vimPlugin-auto-dark-mode" + "vimPlugin-auto-dark-mode": "vimPlugin-auto-dark-mode", + "vimPlugin-telescope-tabs": "vimPlugin-telescope-tabs" } }, "rust-analyzer-src": { @@ -520,6 +521,22 @@ "repo": "auto-dark-mode.nvim", "type": "github" } + }, + "vimPlugin-telescope-tabs": { + "flake": false, + "locked": { + "lastModified": 1756725211, + "narHash": "sha256-5NpH9+0ECrcKi8quPLpCHLSPTuzGETWtq4E+2jqUKio=", + "owner": "LukasPietzschmann", + "repo": "telescope-tabs", + "rev": "777b1f630f3d6a12a2e71635a82581c988d6da2e", + "type": "github" + }, + "original": { + "owner": "LukasPietzschmann", + "repo": "telescope-tabs", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index c1a3856..7d37f2a 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,8 @@ # Custom vim/neovim plugins inputs.vimPlugin-auto-dark-mode.url = "github:f-person/auto-dark-mode.nvim"; inputs.vimPlugin-auto-dark-mode.flake = false; + inputs.vimPlugin-telescope-tabs.url = "github:LukasPietzschmann/telescope-tabs"; + inputs.vimPlugin-telescope-tabs.flake = false; inputs.flox.url = "github:flox/flox/release-1.7.9"; @@ -83,6 +85,8 @@ pname = normalizeName name; version = toPluginVersion inputs.${name}; src = inputs.${name}; + # Disable require check for telescope-tabs (needs telescope.nvim at runtime) + doCheck = if name == "vimPlugin-telescope-tabs" then false else true; }; }) pluginsNames ); diff --git a/homeConfigurations/profiles/common_neovim.nix b/homeConfigurations/profiles/common_neovim.nix index 4bb7fb8..ca0cc5b 100644 --- a/homeConfigurations/profiles/common_neovim.nix +++ b/homeConfigurations/profiles/common_neovim.nix @@ -164,6 +164,27 @@ -- Use the system clipboard o.clipboard = "unnamed" + + -- Terminal mode keybindings + -- Problem: When using vim mode in zsh or Claude Code CLI, single exits + -- vim mode in the shell, but doesn't exit Neovim's terminal mode, causing confusion. + -- + -- Solution: Use double escape and mappings for easy terminal navigation + -- without conflicting with shell vim mode. + -- + -- Keybindings: + -- - Exit terminal mode (first Esc exits shell vim, second exits terminal) + -- h/j/k/l - Navigate to left/down/up/right window directly from terminal + -- - Access all window commands (then use any command) + -- + -- Default Neovim way () still works but is harder to type. + + vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + vim.keymap.set('t', '', '', { desc = 'Window commands from terminal' }) + vim.keymap.set('t', 'h', 'h', { desc = 'Move to left window' }) + vim.keymap.set('t', 'j', 'j', { desc = 'Move to bottom window' }) + vim.keymap.set('t', 'k', 'k', { desc = 'Move to top window' }) + vim.keymap.set('t', 'l', 'l', { desc = 'Move to right window' }) ''; programs.neovim.plugins = @@ -441,7 +462,13 @@ quickfile = { enabled = true }, scroll = { enabled = true }, statuscolumn = { enabled = true }, - terminal = { enabled = true }, -- Replaces toggleterm-nvim + terminal = { + enabled = true, + win = { + position = "right", -- Open terminal on the right side + width = 0.4, -- 40% of screen width + }, + }, words = { enabled = true }, zen = { enabled = true }, -- Replaces zen-mode.nvim }) @@ -1004,6 +1031,68 @@ # A - swap parameter with previous nvim-treesitter-textobjects + # -- TABS / TABLINE ----------------------------------------------------- + + # Highly configurable tabline plugin with custom tab names + # https://github.com/nanozuki/tabby.nvim + # Features: + # - Custom tab names with :TabRename + # - Tab names persist in sessions (add 'globals' to sessionoptions) + # - Declarative, highly customizable tabline + # - Use tabs as workspace multiplexer (one tab per project) + # Keybindings: + # :TabRename - Rename current tab + # tr - Rename tab (mapped below) + { + plugin = tabby-nvim; + type = "lua"; + config = # lua + '' + require('tabby').setup({ + preset = 'active_wins_at_tail', -- Show active windows in each tab + }) + + -- Add 'globals' to sessionoptions to persist tab names + vim.opt.sessionoptions:append("globals") + + require("which-key").add({ + { "t", group = "Terminal/Tabs" }, + { "tr", ":TabRename ", desc = "Rename Tab" }, + }) + ''; + } + + # Telescope extension for switching between tabs + # https://github.com/LukasPietzschmann/telescope-tabs + # Features: + # - Fuzzy search through tabs + # - Shows tab names from tabby.nvim + # - Smart tab history (last shown tab stack) + # Keybindings: + # bt - Browse tabs with telescope + { + plugin = custom-telescope-tabs; + type = "lua"; + config = # lua + '' + require('telescope-tabs').setup({ + -- Display tab names from tabby.nvim + entry_formatter = function(tab_id, buffer_ids, file_names, file_paths, is_current) + local tab_name = require('tabby.feature.tab_name').get(tab_id) + local marker = is_current and ' <' or "" + return string.format('%d: %s%s', tab_id, tab_name, marker) + end, + entry_ordinal = function(tab_id, buffer_ids, file_names, file_paths, is_current) + return require('tabby.feature.tab_name').get(tab_id) + end, + }) + + require("which-key").add({ + { "bt", "lua require('telescope-tabs').list_tabs()", desc = "Browse Tabs" }, + }) + ''; + } + # Navigation using Telescope # https://github.com/nvim-telescope/telescope.nvim/ @@ -1125,21 +1214,20 @@ # Used by: telescope, gitsigns, claude-code, and many other plugins plenary-nvim - # Claude Code CLI integration - opens Claude Code in floating terminal + # Claude Code CLI integration - opens Claude Code in vertical split terminal # https://github.com/greggh/claude-code.nvim # Keybindings: ac (open Claude), at (toggle) - # Features: 90% screen floating window, persistent terminal, quick AI access + # Features: Right-side vertical split (40% width), persistent terminal, quick AI access { plugin = claude-code-nvim; type = "lua"; config = # lua '' require('claude-code').setup({ - -- Use floating window for Claude Code terminal + -- Use vertical split on the right for Claude Code terminal window = { - type = "float", - width = 0.9, - height = 0.9, + position = "vertical", -- Opens on the right side + split_ratio = 0.4, -- 40% of screen width }, })