@@ -38,20 +38,21 @@ USAGE *leap-usage*
38
38
- Enter `{char2}` . If the pair was not labeled, then voilà, you're already
39
39
there. No need to be bothered by remaining labels - those are guaranteed
40
40
"safe" letters, and will disappear on the next keypress -, just continue
41
- editing.
41
+ editing. *leap-autojump*
42
42
- Else: type the label character. If there are too many matches (more than
43
43
~50), you might need to switch to the desired group first, using `<space> `
44
44
(step back with `<tab> ` , if needed).
45
45
46
+ *leap-to-eol* *leap-to-empty-line*
46
47
A character at the end of a line can be targeted by pressing `<space> ` after
47
48
it. There is no special mechanism behind this: `<space> ` is simply an alias
48
49
for the newline character, defined in | leap.opts.equivalence_classes | by
49
50
default.
50
51
51
- A slightly more magical feature is that you can target even empty lines or EOL
52
- positions, by pressing the newline alias twice ( ` <space><space> ` ). This
53
- fulfills the principle that any visible position you can move to with the
54
- cursor should be reachable by Leap too.
52
+ A slightly more magical feature is that you can target even actual EOL
53
+ positions, including empty lines, by pressing the newline alias twice
54
+ ( ` <space><space> ` ). This fulfills the principle that any visible position you
55
+ can move to with the cursor should be reachable by Leap too.
55
56
56
57
*leap-smart-autojump*
57
58
Leap only jumps to the first match if the remaining matches can be covered by
@@ -68,6 +69,9 @@ after invoking a Leap motion (e.g. `s<enter>`), it uses the previous search
68
69
pattern. If you overshoot your target, `<tab> `
69
70
(| leap.opts.special_keys.prev_target | ) can revert the jump(s).
70
71
72
+ In case of using | leap.opts.safe_labels | , the labels will remain available the
73
+ whole time.
74
+
71
75
You cannot traverse through the matches if there is no direction to follow
72
76
(| leap_gs | ), but `<enter> ` still allows you to repeat the previous search
73
77
(`gs<enter> ` ), or to accept the closest - presumably only - match
@@ -149,55 +153,51 @@ to |leap.leap()|. So simply use these strings as `rhs` in |vim.keymap.set()|:
149
153
>lua
150
154
vim.keymap.set({'n', 'x', 'o'}, 'f', '<Plug> (leap-forward)')
151
155
152
-
153
156
Default motions:
154
157
155
158
*<Plug>(leap-forward)*
156
159
arguments: `{}`
157
- default mapping: `s `
158
160
159
161
*<Plug>(leap-backward)*
160
162
arguments: `{ backward = true }`
161
- default mapping: `S `
162
163
163
164
*<Plug>(leap-from-window)*
164
165
arguments: `{ target_windows = require('leap.util').get_enterable_windows() }`
165
- default mapping: `gs`
166
166
167
- Calling `require (' leap' ).create_default_mappings ()` is equivalent to:
168
- >lua
167
+ Calling `require (' leap' ).create_default_mappings ()` is equivalent to: >lua
168
+
169
169
vim.keymap.set({'n', 'x', 'o'}, 's', '<Plug> (leap-forward)')
170
170
vim.keymap.set({'n', 'x', 'o'}, 'S', '<Plug> (leap-backward)')
171
171
vim.keymap.set({'n', 'x', 'o'}, 'gs' , '<Plug> (leap-from-window)')
172
172
173
173
174
- Bidirectional search in the current- window:
174
+ Bidirectional search in the current window:
175
175
176
176
*<Plug>(leap)*
177
177
arguments: `{ target_windows = { vim.api.nvim_get_current_win() } }`
178
- suggested mapping: `s ` (recommended for Normal mode only)
179
178
180
179
`<Plug> (leap)` sorts matches by euclidean (beeline) distance from the cursor,
181
180
with the exception that the current line, and on the current line, forward
182
181
direction is prioritized. That is, you can always be sure that the targets
183
182
right in front of you will be the first ones.
184
183
185
- A suggested alternative arrangement (bidirectional `s ` for Normal mode):
186
- >lua
184
+ Note that you will get twice as many targets and thus half as many autojumps
185
+ on average, but not needing to press the Shift key for backward motions might
186
+ compensate for that. Another caveat is that you cannot traverse through the
187
+ matches (| leap-traversal | ), although invoking repeat right away
188
+ (| leap-repeat | ) can substitute for that.
189
+
190
+ Suggested arrangement: >lua
191
+
187
192
vim.keymap.set('n', 's', '<Plug> (leap)')
188
193
vim.keymap.set('n', 'S', '<Plug> (leap-from-window)')
189
194
vim.keymap.set({'x', 'o'}, 's', '<Plug> (leap-forward)')
190
195
vim.keymap.set({'x', 'o'}, 'S', '<Plug> (leap-backward)')
191
196
192
- Note that you will get half as many autojumps on average, but not needing to
193
- press the Shift key for backward motions might compensate for that.
194
-
195
197
Mapping to `<Plug> (leap)` is not recommended for Visual mode, as autojumping
196
198
in a random direction might be too disorienting with the selection highlight
197
199
on, and neither for Operator-pending mode, as dot-repeat cannot be used if the
198
- search is non-directional. Another caveat is that you cannot traverse through
199
- the matches (| leap-traversal | ), although invoking repeat right away
200
- (| leap-repeat | ) can substitute for that.
200
+ search is non-directional.
201
201
202
202
203
203
Alternative, "fFtT"-style directional set for in-window motions, in the vein
@@ -206,19 +206,23 @@ the whole 2-character match in Visual and Operator-pending-mode:
206
206
207
207
*<Plug>(leap-forward-to)*
208
208
arguments: `{}` in Normal mode, otherwise `{ offset = +1, inclusive_op = true }`
209
- suggested mapping: `s `
210
209
211
210
*<Plug>(leap-backward-to)*
212
211
arguments: `{ backward = true }`
213
- suggested mapping: `S `
214
212
215
213
*<Plug>(leap-forward-till)*
216
214
arguments: `{ offset = -1, inclusive_op = true }`
217
- suggested mapping: `x ` (for Visual and Operator-pending mode only)
218
215
219
216
*<Plug>(leap-backward-till)*
220
217
arguments: `{ backward = true, offset = 2 }`
221
- suggested mapping: `X` (for Visual and Operator-pending mode only)
218
+
219
+ Suggested arrangement: >lua
220
+
221
+ vim.keymap.set({'n', 'x', 'o'}, 's', '<Plug> (leap-forward-to)')
222
+ vim.keymap.set({'n', 'x', 'o'}, 'S', '<Plug> (leap-backward-to)')
223
+ vim.keymap.set({'x', 'o'}, 'x', '<Plug> (leap-forward-till)')
224
+ vim.keymap.set({'x', 'o'}, 'X', '<Plug> (leap-backward-till)')
225
+ vim.keymap.set({'n', 'x', 'o'}, 'gs' , '<Plug> (leap-from-window)')
222
226
223
227
224
228
To create custom motions with behaviours different from the predefined ones,
@@ -345,26 +349,21 @@ liking (using |:hi| or |nvim_set_hl()|):
345
349
346
350
*hl-LeapMatch*
347
351
LeapMatch
348
- Matches that can be reached directly, without having to use a label. (By
349
- default, this group is only used for | leap-traversal | .)
352
+ Matches that can be reached without picking a label. By default, this
353
+ group is only used for | leap-traversal | .
350
354
351
355
*hl-LeapLabelPrimary*
352
356
LeapLabelPrimary
353
- The character needed to be pressed to jump to the match position, after
354
- the whole search pattern has been given. It appears once the first input
355
- has been entered, right next to the pair.
357
+ Target labels in the currently selected group.
356
358
357
359
*hl-LeapLabelSecondary*
358
360
LeapLabelSecondary
359
- If the number of matches exceeds the available target labels, the next
360
- group of labels are shown with a different color. Those targets can be
361
- reached by pressing | leap.opts.special_keys.next_group | before the label
362
- character.
361
+ Target labels in the group(s) beyond the currently selected one.
363
362
364
363
*hl-LeapBackdrop*
365
364
LeapBackdrop
366
- In some cases it might be useful to apply certain settings on the rest of
367
- the area, like disabling certain | attr-list | attributes, or adding a
365
+ In some cases it might be useful to apply certain settings on the whole
366
+ search area, like disabling certain | attr-list | attributes, or adding a
368
367
uniform grey foreground color, to make labels easier to see. This group is
369
368
not set by default.
370
369
0 commit comments