Home

Awesome

Description

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.

Installation

Either use packadd or any package manager. I recommend using lazy.nvim.

Requirements

Examples

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:

Usage

Enter nvim-tabmode with <leader><Tab> or :TabmodeEnter.

KeyUse
<Esc>Leave tabmode
?Show help message
^/0Go 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/hTab left
w/k/lTab right
aAppend a tab and switch to it.
AAppend a tab to the end and switch to it.
iPrepend a tab and switch to it.
IPrepend a tab to the beginning and switch to it.
dDelete the current tab.
sReplace the current tab with a new tab.

See :help tabmode-usage for additional details.

Configuration

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',
  }
}