This is a LUA port of tpopes famous vim-unimpaired plugin. unimpaired.nvim
aims to replicate the exact behaviour of vim-unimpaired
, with some exceptions (see caveats).
unimpaired.nvim
is a collection of useful keymaps which follow a pattern: They
come in complementary pairs which mostly fall into four categories:
]q
is :cnext
. [q
is :cprevious
. ]a
is :next
. [b
is :bprevious
. See the default configuration for the full set of 20 mappings[<Space>
and ]<Space>
add newlines before and after the cursor line. [e
and ]e
exchange the current line with the one above or below it.[os
, ]os
, and yos
perform :set spell
, :set nospell
, and :set invspell
, respectively. There's also l
(list), n
(number), w
(wrap), x
(cursorline cursorcolumn), and several others[f
and ]f
to go to the next/previous file in the directory, and [n
and ]n
to jump between SCM conflict markers (the latter is not implemented yet)Install the plugin with your favourite package manager.
Example using lazy:
{
'tummetott/unimpaired.nvim',
event = 'VeryLazy',
opts = {
-- add options here if you wish to override the default settings
},
}
The setup()
function takes a dictionary with user configurations. If you don't
want to customize the default behaviour, you don't need to put anything in
there. The default behaviour mimics the functionality off vim-unimpaired
.
Customizing keymaps works as following:
require('unimpaired').setup {
keymaps = {
-- To overwrite the mapping, keymap description and dot-repetition for
-- ':bnext', write
bnext = {
mapping = '<leader>n',
description = 'Go to [count] next buffer',
dot_repeat = true,
},
-- To disable dot repetition for ':bprevious', write
bprevious = {
mapping = '<leader>p',
description = 'Go to [count] previous buffer',
dot_repeat = false,
},
-- If you just want to change the keymap for ':bfirst' and don't care
-- about desciption and dot-repetition, write the shorthand
bfirst = '<leader>N',
-- To disable the kemap ':blast' completely, set it to false
blast = false,
}
-- Disable the default mappings if you prefer to define your own mappings
default_keymaps = false,
}
To see all keys of the keymaps
table, have a look at the default setup options of unimpaired.nvim
:
This plugin is work in progress. You may experience bugs and changes of the API.
Functionalities which are not supported yet:
PRs are welcome! x Tummetott