Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #8783 add easymotionSearchLines #9100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading