-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Feature Description
<LocalLeader> is recommended to be used for mappings which are local to a buffer
As says in :h <LocalLeader>:
*<LocalLeader>* *maplocalleader*
<LocalLeader> is just like <Leader>, except that it uses "maplocalleader"
instead of "mapleader". <LocalLeader> is to be used for mappings which are
local to a buffer. Example: >
:map <buffer> <LocalLeader>A oanother line<Esc>
<
In a global plugin <Leader> should be used and in a filetype plugin
<LocalLeader>. "mapleader" and "maplocalleader" can be equal. Although, if
you make them different, there is a smaller chance of mappings from global
plugins to clash with mappings for filetype plugins. For example, you could
keep "mapleader" at the default backslash, and set "maplocalleader" to an
underscore.Use Case
The plugin is only activated on filetype autocommands, which avoids overriding mappings in non-Markdown buffers.
However, if I want to have some global mappings like <leader>tt for toggling the terminal, conflicts may still occur. Therefore, I need to remap them.
Currently, this plugin supports multiple ways to customize keymaps:
- Disable default keymaps and manually configure them using
<Plug>or Lua APIs - Use
table.keymaps.prefix - Configure options under
keymaps
However, all these methods require writing many lines of repetitive boilerplate code except for table.keymaps.prefix method.
<LocalLeader> almost perfectly solves this issue.
Proposed Solution
Simply perform s/<leader>/<localleader> in this repository.
Since this is a breaking change, users should be warned.
Alternatives Considered
Add configuration options similar to table.keymaps.prefix for all features.
Alternatively, implement both <localleader> and the prefix option.