diff --git a/README.md b/README.md index 7909f7b2c..907847d35 100644 --- a/README.md +++ b/README.md @@ -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 `` map to in key remappings? + * Type: string (Default: `\`) + ## Configure Vim options are loaded in the following sequence: diff --git a/package.json b/package.json index d43962383..229a82fe4 100644 --- a/package.json +++ b/package.json @@ -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 map to in remappings?", + "default": "\\" + }, "vim.searchHighlightColor": { "type": "string", "description": "Color of the search highlight.", diff --git a/src/configuration/configuration.ts b/src/configuration/configuration.ts index 40486e10a..9440e2d54 100644 --- a/src/configuration/configuration.ts +++ b/src/configuration/configuration.ts @@ -116,6 +116,11 @@ class ConfigurationClass { */ showcmd = true; + /** + * What key should map to in key remappings? + */ + leader = "\\"; + /** * Show results of / or ? search as user is typing? */ diff --git a/src/notation.ts b/src/notation.ts index 704d54c38..e87792c18 100644 --- a/src/notation.ts +++ b/src/notation.ts @@ -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() === "") { + return Configuration.leader; + } + for (const notationMapKey in this._notationMap) { if (this._notationMap.hasOwnProperty(notationMapKey)) { const regex = new RegExp(this._notationMap[notationMapKey].join('|'), 'gi');