nvim-tabmode is a plugin that provides a new mode in Neo/vim for managing tabs.
Although it is recommended that splits and buffers are used over tabs when possible, there are scenarios when tabs are necessary. This plugin hopes to make that easier.
Either use packadd or any package manager. I recommend using lazy.nvim.
- Neovim 0.7+
- nvim-libmodal
- vim-tabmode is NOT installed.
lazy.nvim:
{'Iron-E/nvim-tabmode',
cmd = 'TabmodeEnter', -- don't load until using this command
config = true, -- automatically call `bufmode.setup()`; not needed if you specify `opts`
dependencies = {'Iron-E/nvim-libmodal'},
keys = {{'<Leader><Tab>', desc = 'Enter buffer mode', mode = 'n'}}, -- don't load until pressing these keys
-- opts = {}, (put `setup` options here, e.g. `opts = {enter_mapping = false}`
},Other examples:
- dein.vim:
- Add
call dein#add('https://github.com/Iron-E/nvim-bufmode')to~/.config/nvim/init.vim :call dein#install()
- Add
- NeoBundle:
- Add
NeoBundle 'https://github.com/Iron-E/nvim-bufmode'to~/.config/nvim/init.vim - Re-open vim or execute
:source ~/.vimrc
- Add
- vim-plug:
- Add
Plug 'https://github.com/Iron-E/nvim-bufmode'to~/.config/nvim/init.vim :PlugInstallor$ vim +PlugInstall +qall
- Add
- Vundle:
- Add
Plugin 'https://github.com/Iron-E/nvim-bufmode'to~/.config/nvim/init.vim :PluginInstallor$ vim +PluginInstall +qall
- Add
Enter nvim-tabmode with <leader><Tab> or :TabmodeEnter.
| Key | Use |
|---|---|
<Esc> |
Leave tabmode |
? |
Show help message |
^/0 |
Go to the beginning of the tab list. |
<S-0> |
Move the current tab to the beginning of the tab list. |
$ |
Go to the end of the tab list. |
% |
Move the current tab to the end of the tab list. |
b/j/h |
Tab left |
w/k/l |
Tab right |
a |
Append a tab and switch to it. |
A |
Append a tab to the end and switch to it. |
i |
Prepend a tab and switch to it. |
I |
Prepend a tab to the beginning and switch to it. |
d |
Delete the current tab. |
s |
Replace the current tab with a new tab. |
See :help tabmode-usage for additional details.
To customize the plugin, set vim.g.bufmode_mappings before loading it, or call
setup after:
let g:bufmode_mappings = {
\ '$': 'tablast',
\ '%': '$tabmove',
\ ')': '0tabmove',
\ '0': 'tabfirst',
\ '?': 'help tabmode-usage',
\ 'a': 'tabnew',
\ 'A': '$tabnew',
\ 'b': 'tabprevious',
\ 'B': '-tabmove',
\ 'd': 'tabclose',
\ 'i': '-tabnew',
\ 'I': '0tabnew',
}require('tabmode').setup {
enter_mapping = '<leader><tab>', -- false to disable
bufferline = false, -- add bufferline.nvim keymaps
barbar = false, -- add barbar.nvim keymaps
keymaps = { -- defaults:
['$'] = 'tablast',
['%'] = '$tabmove',
[')'] = '0tabmove',
['0'] = 'tabfirst',
['?'] = 'help tabmode-usage',
['a'] = 'tabnew',
['A'] = '$tabnew',
['b'] = 'tabprevious',
['B'] = '-tabmove',
['d'] = 'tabclose',
['i'] = '-tabnew',
['I'] = '0tabnew',
}
}