diff --git a/README.md b/README.md index 7832a5825a7..1b06d2f8632 100644 --- a/README.md +++ b/README.md @@ -546,6 +546,7 @@ Based on [vim-easymotion](https://github.com/easymotion/vim-easymotion) and conf | vim.easymotionMarkerFontWeight | The font weight used for the marker text. | String | 'bold' | | vim.easymotionKeys | The characters used for jump marker name | String | 'hklyuiopnm,qwertzxcvbasdgjf;' | | vim.easymotionJumpToAnywhereRegex | Custom regex to match for JumpToAnywhere motion (analogous to `Easymotion_re_anywhere`) | String | `\b[A-Za-z0-9]\|[A-Za-z0-9]\b\|_.\|#.\|[a-z][A-Z]` | +| vim.easymotionSearchLines | Set the number of lines for the easymotion search. | Number | 100 | Once easymotion is active, initiate motions using the following commands. After you initiate the motion, text decorators/markers will be displayed and you can press the keys displayed to jump to that position. `leader` is configurable and is `\` by default. diff --git a/package.json b/package.json index d4f07669cf9..f06af6b902b 100644 --- a/package.json +++ b/package.json @@ -677,6 +677,11 @@ "description": "Regex matches for JumpToAnywhere motion.", "default": "\\b[A-Za-z0-9]|[A-Za-z0-9]\\b|_.|#.|[a-z][A-Z]" }, + "vim.easymotionSearchLines": { + "type": "number", + "description": "Set the number of lines for the easymotion search.", + "default": 100 + }, "vim.replaceWithRegister": { "type": "boolean", "markdownDescription": "Enable the [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister) plugin for Vim.", diff --git a/src/actions/plugins/easymotion/easymotion.ts b/src/actions/plugins/easymotion/easymotion.ts index bb1d40b8cfa..4a69b455a04 100644 --- a/src/actions/plugins/easymotion/easymotion.ts +++ b/src/actions/plugins/easymotion/easymotion.ts @@ -144,9 +144,9 @@ export class EasyMotion implements IEasyMotion { if ( (options.min && pos.isBefore(options.min)) || (options.max && pos.isAfter(options.max)) || - Math.abs(pos.line - position.line) > 100 + Math.abs(pos.line - position.line) > configuration.easymotionSearchLines ) { - // Stop searching after 100 lines in both directions + // Stop searching after 100(default) lines in both directions result = regex.exec(line); } else { // Update cursor index to the marker on the right side of the cursor diff --git a/src/configuration/configuration.ts b/src/configuration/configuration.ts index dae4a38b138..fb5942eb7c7 100644 --- a/src/configuration/configuration.ts +++ b/src/configuration/configuration.ts @@ -267,6 +267,7 @@ class Configuration implements IConfiguration { easymotionMarkerFontWeight = 'bold'; easymotionKeys = 'hklyuiopnm,qwertzxcvbasdgjf;'; easymotionJumpToAnywhereRegex = '\\b[A-Za-z0-9]|[A-Za-z0-9]\\b|_.|#.|[a-z][A-Z]'; + easymotionSearchLines = 100; targets: ITargetsConfiguration = { enable: false, diff --git a/src/configuration/iconfiguration.ts b/src/configuration/iconfiguration.ts index 80861d28264..8bd539e56e8 100644 --- a/src/configuration/iconfiguration.ts +++ b/src/configuration/iconfiguration.ts @@ -194,6 +194,8 @@ export interface IConfiguration { easymotionDimBackground: boolean; easymotionMarkerFontWeight: string; easymotionKeys: string; + easymotionJumpToAnywhereRegex: string; + easymotionSearchLines: number; /** * Timeout in milliseconds for remapped commands. diff --git a/test/testConfiguration.ts b/test/testConfiguration.ts index b4877fe097d..91a3df0033b 100644 --- a/test/testConfiguration.ts +++ b/test/testConfiguration.ts @@ -42,6 +42,8 @@ export class Configuration implements IConfiguration { easymotionDimBackground = true; easymotionMarkerFontWeight = 'bold'; easymotionKeys = 'hklyuiopnm,qwertzxcvbasdgjf;'; + easymotionJumpToAnywhereRegex = '\\b[A-Za-z0-9]|[A-Za-z0-9]\\b|_.|#.|[a-z][A-Z]'; + easymotionSearchLines = 100; targets: ITargetsConfiguration = { enable: false, bracketObjects: {