Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rBrda/myKeymap

A simple plugin to list and search key mappings in (neo)vim. Based on fzf.vim.
https://github.com/rBrda/myKeymap

fzf neovim neovim-plugin vim vim-plugins

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# myKeymap

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

Based on [fzf.vim](https://github.com/junegunn/fzf.vim).

![mykeymap](https://user-images.githubusercontent.com/22145465/98745430-d84d6100-23b3-11eb-8c89-10869b23e458.png)

## Usage

Let's suppose you defined the following key mappings to navigate between open windows more easily. They look like this:

```vim
" Navigating between open windows
nnoremap l
nnoremap h
nnoremap k
nnoremap 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.

```vim
" Navigating between open windows
" @(Windows -> right)
nnoremap l
" @(Windows -> left)
nnoremap h
" @(Windows -> up)
nnoremap k
" @(Windows -> down)
nnoremap j
```

### How to add annotations to your key bindings?

The annotation must be placed just above the key mapping it belongs to, like this:

```vim
" @(Shift indentation)
vnoremap >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](https://github.com/junegunn/fzf.vim) to be installed!

With [vim-plug](https://github.com/junegunn/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):

```vim
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.