Skip to content

Commit

Permalink
fixes VSCodeVim#8783 add easymotionSearchLines
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryTSZ committed Jun 28, 2024
1 parent a4ac2b3 commit 3130178
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 2 additions & 2 deletions src/actions/plugins/easymotion/easymotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/configuration/iconfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ export interface IConfiguration {
easymotionDimBackground: boolean;
easymotionMarkerFontWeight: string;
easymotionKeys: string;
easymotionJumpToAnywhereRegex: string;
easymotionSearchLines: number;

/**
* Timeout in milliseconds for remapped commands.
Expand Down
2 changes: 2 additions & 0 deletions test/testConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 3130178

Please sign in to comment.