Skip to content

Commit 25753d8

Browse files
committed
docs: tweaks
1 parent 6b3054c commit 25753d8

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,16 @@ with the exception that the current line, and on the current line, forward
236236
direction is prioritized. That is, you can always be sure that the targets
237237
right in front of you will be the first ones.
238238

239-
Note that you will get half as many autojumps on average, but not needing to
240-
press the Shift key for backward motions might compensate for that.
239+
Note that you will get twice as many targets and thus half as many autojumps on
240+
average, but not needing to press the Shift key for backward motions might
241+
compensate for that. Another caveat is that you cannot traverse through the
242+
matches (`:h leap-traversal`), although invoking repeat right away (`:h
243+
leap-repeat`) can substitute for that.
241244

242245
Mapping to `<Plug>(leap)` is not recommended for Visual mode, as autojumping in
243246
a random direction might be too disorienting with the selection highlight on,
244247
and neither for Operator-pending mode, as dot-repeat cannot be used if the
245-
search is non-directional. Another caveat is that you cannot traverse through
246-
the matches (`:h leap-traversal`), although invoking repeat right away (`:h
247-
leap-repeat`) can substitute for that.
248+
search is non-directional.
248249

249250
For further customization, see `:h leap-custom-mappings`.
250251

doc/leap.txt

+35-36
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,21 @@ USAGE *leap-usage*
3838
- Enter `{char2}`. If the pair was not labeled, then voilà, you're already
3939
there. No need to be bothered by remaining labels - those are guaranteed
4040
"safe" letters, and will disappear on the next keypress -, just continue
41-
editing.
41+
editing. *leap-autojump*
4242
- Else: type the label character. If there are too many matches (more than
4343
~50), you might need to switch to the desired group first, using `<space>`
4444
(step back with `<tab>`, if needed).
4545

46+
*leap-to-eol* *leap-to-empty-line*
4647
A character at the end of a line can be targeted by pressing `<space>` after
4748
it. There is no special mechanism behind this: `<space>` is simply an alias
4849
for the newline character, defined in |leap.opts.equivalence_classes| by
4950
default.
5051

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.
5556

5657
*leap-smart-autojump*
5758
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
6869
pattern. If you overshoot your target, `<tab>`
6970
(|leap.opts.special_keys.prev_target|) can revert the jump(s).
7071

72+
In case of using |leap.opts.safe_labels|, the labels will remain available the
73+
whole time.
74+
7175
You cannot traverse through the matches if there is no direction to follow
7276
(|leap_gs|), but `<enter>` still allows you to repeat the previous search
7377
(`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()|:
149153
>lua
150154
vim.keymap.set({'n', 'x', 'o'}, 'f', '<Plug>(leap-forward)')
151155

152-
153156
Default motions:
154157

155158
*<Plug>(leap-forward)*
156159
arguments: `{}`
157-
default mapping: `s`
158160

159161
*<Plug>(leap-backward)*
160162
arguments: `{ backward = true }`
161-
default mapping: `S`
162163

163164
*<Plug>(leap-from-window)*
164165
arguments: `{ target_windows = require('leap.util').get_enterable_windows() }`
165-
default mapping: `gs`
166166

167-
Calling `require('leap').create_default_mappings()` is equivalent to:
168-
>lua
167+
Calling `require('leap').create_default_mappings()` is equivalent to: >lua
168+
169169
vim.keymap.set({'n', 'x', 'o'}, 's', '<Plug>(leap-forward)')
170170
vim.keymap.set({'n', 'x', 'o'}, 'S', '<Plug>(leap-backward)')
171171
vim.keymap.set({'n', 'x', 'o'}, 'gs', '<Plug>(leap-from-window)')
172172

173173

174-
Bidirectional search in the current-window:
174+
Bidirectional search in the current window:
175175

176176
*<Plug>(leap)*
177177
arguments: `{ target_windows = { vim.api.nvim_get_current_win() } }`
178-
suggested mapping: `s` (recommended for Normal mode only)
179178

180179
`<Plug>(leap)` sorts matches by euclidean (beeline) distance from the cursor,
181180
with the exception that the current line, and on the current line, forward
182181
direction is prioritized. That is, you can always be sure that the targets
183182
right in front of you will be the first ones.
184183

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+
187192
vim.keymap.set('n', 's', '<Plug>(leap)')
188193
vim.keymap.set('n', 'S', '<Plug>(leap-from-window)')
189194
vim.keymap.set({'x', 'o'}, 's', '<Plug>(leap-forward)')
190195
vim.keymap.set({'x', 'o'}, 'S', '<Plug>(leap-backward)')
191196

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-
195197
Mapping to `<Plug>(leap)` is not recommended for Visual mode, as autojumping
196198
in a random direction might be too disorienting with the selection highlight
197199
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.
201201

202202

203203
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:
206206

207207
*<Plug>(leap-forward-to)*
208208
arguments: `{}` in Normal mode, otherwise `{ offset = +1, inclusive_op = true }`
209-
suggested mapping: `s`
210209

211210
*<Plug>(leap-backward-to)*
212211
arguments: `{ backward = true }`
213-
suggested mapping: `S`
214212

215213
*<Plug>(leap-forward-till)*
216214
arguments: `{ offset = -1, inclusive_op = true }`
217-
suggested mapping: `x` (for Visual and Operator-pending mode only)
218215

219216
*<Plug>(leap-backward-till)*
220217
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)')
222226

223227

224228
To create custom motions with behaviours different from the predefined ones,
@@ -345,26 +349,21 @@ liking (using |:hi| or |nvim_set_hl()|):
345349

346350
*hl-LeapMatch*
347351
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|.
350354

351355
*hl-LeapLabelPrimary*
352356
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.
356358

357359
*hl-LeapLabelSecondary*
358360
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.
363362

364363
*hl-LeapBackdrop*
365364
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
368367
uniform grey foreground color, to make labels easier to see. This group is
369368
not set by default.
370369

0 commit comments

Comments
 (0)