Awesome Open Source
Awesome Open Source

myKeymap

A simple plugin to list and search key mappings in (neo)vim.

Based on fzf.vim.

mykeymap

Usage

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

How to add annotations to your key bindings?

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!

How to list and search your annotated key mappings?

The plugin has the MyKeymap command for listing the annotated key mappings. They will be shown in a fzf popup window.

Installation

It requires fzf.vim to be installed!

With vim-plug:

Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'rBrda/myKeymap'

Configuration

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 mapping
  • source : shows the source file and line number of the key mapping

g: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.



Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Plugin (113,998
Vim (18,649
Vim Script (11,465
Mapping (7,887
Neovim (3,919
Vim Plugin (2,484
Neo (1,415
Fzf (961
Neovim Plugin (611