vim Map leader key combination


The leader key could be used as a way to create a mapping with a key-binding that can be overridden by the end user.

The leader is the \ key by default. In order to override it, the end-user would have to execute :let g:mapleader='somekey(s)' before defining the mapping.

In a typical scenario, the mapleader is set in the .vimrc, and plugins use <Leader> in the keybinding part of their mappings to have them customizable.

In the plugin, we would define mappings with:

:nnoremap <Leader>a somecomplexaction

This would map the somecomplexaction action to the \+a key combination.

The a action without the leader does not change.

It's also possible to use <Plug>Mappings to leave more room to customise plugins keybindings.