Add <leader> support.

This commit is contained in:
johnfn 2016-12-04 20:21:36 -05:00
parent 6bb5c4e8a5
commit 64a2752732
4 changed files with 20 additions and 0 deletions

View File

@ -151,6 +151,10 @@ Bind `ZZ` to save and close the current file:
* Width to word-wrap to when using `gq`.
* Type: number (Default: `80`)
#### leader
* What key should `<leader>` map to in key remappings?
* Type: string (Default: `\`)
## Configure
Vim options are loaded in the following sequence:

View File

@ -269,6 +269,11 @@
"description": "Enable some vim ctrl key commands that override otherwise common operations, like ctrl+c",
"default": true
},
"vim.leader": {
"type": "string",
"description": "What key should <leader> map to in remappings?",
"default": "\\"
},
"vim.searchHighlightColor": {
"type": "string",
"description": "Color of the search highlight.",

View File

@ -116,6 +116,11 @@ class ConfigurationClass {
*/
showcmd = true;
/**
* What key should <leader> map to in key remappings?
*/
leader = "\\";
/**
* Show results of / or ? search as user is typing?
*/

View File

@ -1,3 +1,5 @@
import { Configuration } from './configuration/configuration';
export class AngleBracketNotation {
// Mapping from the nomalized string to regex strings that could match it.
@ -27,6 +29,10 @@ export class AngleBracketNotation {
return "\n";
}
if (key.toLowerCase() === "<leader>") {
return Configuration.leader;
}
for (const notationMapKey in this._notationMap) {
if (this._notationMap.hasOwnProperty(notationMapKey)) {
const regex = new RegExp(this._notationMap[notationMapKey].join('|'), 'gi');