Switch between git worktrees from inside Neovim — fuzzy-find, jump in, keep coding.
tak.nvim is the Neovim companion for tak,
a CLI for managing git worktrees. If you already use tak in the terminal,
this lets you do the same thing without leaving the editor: a fuzzy picker
over your worktrees that :cds into the one you choose.
If you've ever:
- Stashed work to switch branches just to fix one quick thing
- Opened a second terminal tab to look at
mainwhile staying on your feature branch - Lost flow rebuilding mental context after
git checkout
…worktrees fix that — one branch per directory, no stashing — and tak.nvim
makes hopping between them as fast as opening a file.
:Tak— fuzzy-find a worktree and:cdNeovim into it.:TakAdd [branch]— create a new worktree withtak add, then jump in.- Works with what you have. Auto-detects fzf-lua or telescope.nvim. With
neither installed, falls back to Neovim's built-in
vim.ui.select. - Default keymaps —
<leader>tw(pick) and<leader>ta(add). - Pinned worktrees are marked with 📌 in the picker.
- Lightweight — under 300 lines of Lua. The plugin shells out to the
takCLI for everything; the CLI stays the source of truth.
- Neovim 0.10+ (uses
vim.system,vim.json) takon$PATH- Optional, recommended: fzf-lua or telescope.nvim for a proper fuzzy picker
Drop this in ~/.config/nvim/lua/plugins/tak.lua:
return {
"mzner/tak.nvim",
-- Optional: declare your fuzzy finder so it loads first
-- dependencies = { "ibhagwan/fzf-lua" },
-- dependencies = { "nvim-telescope/telescope.nvim" },
cmd = { "Tak", "TakAdd" },
keys = {
{ "<leader>tw", "<cmd>Tak<cr>", desc = "Pick worktree" },
{ "<leader>ta", "<cmd>TakAdd<cr>", desc = "Add worktree" },
},
opts = {},
}That's it. Restart Neovim and hit <leader>tw from any tak-enabled repo.
use {
"mzner/tak.nvim",
config = function() require("tak").setup() end,
}If you're hacking on the plugin locally:
return {
"mzner/tak.nvim",
dir = "~/projects/tak.nvim",
cmd = { "Tak", "TakAdd" },
opts = {},
}| Trigger | What it does |
|---|---|
<leader>tw or :Tak |
Open the worktree picker. <CR> cds into the selected worktree. |
<leader>ta or :TakAdd |
Prompt for a branch name, run tak add, then open the picker. |
:TakAdd feature/foo |
Non-interactive: create feature/foo directly. |
The picker shows every worktree in the current repo. Pinned ones (tak pin)
are tagged with 📌. Selecting an entry runs tak cd <branch> and changes
Neovim's working directory — so file pickers, terminals, LSP root detection,
and :cd-aware plugins all see the new location.
All options shown with defaults:
require("tak").setup({
keymaps = {
pick = "<leader>tw", -- :Tak
add = "<leader>ta", -- :TakAdd
},
-- keymaps = false, -- disable all default keymaps
})The plugin auto-detects fzf-lua → telescope.nvim → vim.ui.select. Override:
vim.g.tak_picker = "telescope" -- or "fzf" or "ui"The plugin doesn't reimplement anything from tak — it shells out:
:Takreadstak ls --jsonand renders the entries in the picker. Each entry already has itspath, so selecting one just runs:cddirectly.:TakAddrunstak add <branch>and re-opens the picker.
That's why this plugin can stay tiny: the heavy lifting (config, git, paths,
state) all lives in the CLI. If tak learns a new trick, the plugin doesn't
need to.
tak: command not found — install tak
and confirm it's on $PATH from the shell Neovim was launched from.
Picker is empty — you're not inside a tak-enabled repo, or the repo has
no worktrees yet. Run tak init then tak add <branch> from the terminal.
Edits to plugin files don't take effect — require() caches modules. Run
:Lazy reload tak.nvim or restart Neovim.
MIT