A simple plugin to list and search key mappings in (neo)vim.
Based on fzf.vim.
Let's suppose you defined the following key mappings to navigate between open windows more easily. They look like this:
" Navigating between open windows
nnoremap <C-l> <C-W>l
nnoremap <C-h> <C-W>h
nnoremap <C-k> <C-W>k
nnoremap <C-j> <C-W>j
With the help of this plugin you can add annotations to your key mappings. This way the plugin will be able to find them and list them for you.
" Navigating between open windows
" @(Windows -> right)
nnoremap <C-l> <C-W>l
" @(Windows -> left)
nnoremap <C-h> <C-W>h
" @(Windows -> up)
nnoremap <C-k> <C-W>k
" @(Windows -> down)
nnoremap <C-j> <C-W>j
The annotation must be placed just above the key mapping it belongs to, like this:
" @(Shift indentation)
vnoremap <Tab> >gv
Use descriptive naming for your key mappings, this way it's easier to search them.
Note: you must restart your editor whenever you added or modified the annotations of your key mappings!
The plugin has the MyKeymap
command for listing the annotated key mappings. They will be shown in a fzf popup window.
It requires fzf.vim to be installed!
With vim-plug:
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'rBrda/myKeymap'
You can configure the plugin by setting the following global variable in your (neo)vim configuration file (here you see all the properties included that can be modified):
let g:myKeymapSettings = {
\ 'show_details': ['action'],
\ 'disable_cache': 0,
\ }
g:myKeymapSettings.show_details
Default value: ['action']
Possible values: ['action', 'source']
This is a list of details that can be shown in the result list about the key mapping.
Meaning of the available values:
action
: shows the mapped command of the key mappingsource
: shows the source file and line number of the key mappingg:myKeymapSettings.disable_cache
Default value: 0
If the cache is turned off (1
), the plugin will always read your (neo)vim configuration files when the MyKeymap
command is issued.