When you are in Neovim, switching between multiple TMUX sessions can be cumbersome, requiring you to leave your editor and manually navigate the command line. This disrupts your workflow, especially when managing numerous sessions. The constant context-switching between the terminal and Neovim slows down productivity and can be frustrating for users who need a more seamless experience.
TMUX Switch solves this problem by integrating fuzzy search within Neovim, allowing you to quickly switch between TMUX sessions without leaving your editor. By using this plugin, you can navigate and manage your TMUX sessions directly from Neovim which improves your overall productivity.
tmux-switch.nvim/
├── LICENSE
├── lua
│ └── tmux-switch
│ ├── commands.lua # Commands exposed to Neovim
│ ├── init.lua # Plugin entry point
│ ├── tmux.lua # Tmux commands related logic
│ ├── ui.lua # UI logic (pickers and layout)
│ └── util.lua # Utility functions
└── README.md
sort_by_recent_use
option is set to true, then just enter the :TmuxSwitch
command and select the first one)not_use_telescope
is set to true. Then vim.ui.select
is used.Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'MunifTanjim/nui.nvim'
Plug 'jkeresman01/tmux-switch.nvim'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
-- or , branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
use 'MunifTanjim/nui.nvim'
use 'jkeresman01/tmux-switch.nvim'
Following commands have been exposed to Neovim:
Commands
:TmuxSwitch -- Lunch picker (select tmux session to switch to)
:TmuxCreateSession -- Create new session and give it a name
:TmuxRenameSession -- Rename current tmux session
Set the keybindings as you see fit, here is one example:
require('tmux-switch').setup({})
vim.keymap.set("n", "<C-f>", "<CMD>TmuxSwitch<CR>")
vim.keymap.set("n", "<leader>cs", "<CMD>TmuxCreateSession<CR>"
vim.keymap.set("n", "<leader>rs", "<CMD>TmuxRenameSession<CR>"
Keybindings | Action |
---|---|
<C-f> |
Lunch TMUX switch UI (fuzzy search trough tmux sessions) |
<leader>cs |
Lunch TMUX switch UI (create new TMUX session and name it) |
<leader>rs |
Lunch TMUX switch UI (rename current TMUX session) |