forked from echasnovski/mini.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmini-jump.txt
201 lines (154 loc) · 7.47 KB
/
mini-jump.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
*mini.jump* Jump to next/previous single character
*MiniJump*
MIT License Copyright (c) 2021 Evgeni Chasnovski, Adam Blažek
==============================================================================
Features:
- Extend f, F, t, T to work on multiple lines.
- Repeat jump by pressing f, F, t, T again. It is reset when cursor moved
as a result of not jumping or timeout after idle time (duration
customizable).
- Highlight (after customizable delay) all possible target characters and
stop it after some (customizable) idle time.
- Normal, Visual, and Operator-pending (with full dot-repeat) modes are
supported.
This module follows vim's 'ignorecase' and 'smartcase' options. When
'ignorecase' is set, f, F, t, T will match case-insensitively. When
'smartcase' is also set, f, F, t, T will only match lowercase
characters case-insensitively.
# Setup~
This module needs a setup with `require('mini.jump').setup({})`
(replace `{}` with your `config` table). It will create global Lua table
`MiniJump` which you can use for scripting or manually (with
`:lua MiniJump.*`).
See |MiniJump.config| for `config` structure and default values.
You can override runtime config settings locally to buffer inside
`vim.b.minijump_config` which should have same structure as
`MiniJump.config`. See |mini.nvim-buffer-local-config| for more details.
To stop module from showing non-error feedback, set `config.silent = true`.
# Highlight groups~
* `MiniJump` - all possible cursor positions.
To change any highlight group, modify it directly with |:highlight|.
# Disabling~
To disable core functionality, set `vim.g.minijump_disable` (globally) or
`vim.b.minijump_disable` (for a buffer) to `true`. Considering high number of
different scenarios and customization intentions, writing exact rules for
disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
------------------------------------------------------------------------------
*MiniJump.setup()*
`MiniJump.setup`({config})
Module setup
Parameters~
{config} `(table|nil)` Module config table. See |MiniJump.config|.
Usage~
`require('mini.jump').setup({})` (replace `{}` with your `config` table)
------------------------------------------------------------------------------
*MiniJump.config*
`MiniJump.config`
Module config
Default values:
>
MiniJump.config = {
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
forward = 'f',
backward = 'F',
forward_till = 't',
backward_till = 'T',
repeat_jump = ';',
},
-- Delay values (in ms) for different functionalities. Set any of them to
-- a very big number (like 10^7) to virtually disable.
delay = {
-- Delay between jump and highlighting all possible jumps
highlight = 250,
-- Delay between jump and automatic stop if idle (no jump is done)
idle_stop = 10000000,
},
-- Whether to disable showing non-error feedback
silent = false,
}
<
------------------------------------------------------------------------------
*MiniJump.state*
`MiniJump.state`
Data about jumping state
It stores various information used in this module. All elements, except
`jumping`, is about the latest jump. They are used as default values for
similar arguments.
Class~
{JumpingState}
Fields~
{target} `(string|nil)` The string to jump to.
{backward} `(boolean|nil)` Whether to jump backward.
{till} `(boolean|nil)` Whether to jump just before/after the match instead of
exactly on target. This includes positioning cursor past the end of
previous/current line. Note that with backward jump this might lead to
cursor being on target if can't be put past the line.
{n_times} `(number|nil)` Number of times to perform consecutive jumps.
{mode} `(string)` Mode of latest jump (output of |mode()| with non-zero argument).
{jumping} `(boolean)` Whether module is currently in "jumping mode": usage of
|MiniJump.smart_jump| and all mappings won't require target.
Initial values:
>
MiniJump.state = {
target = nil,
backward = false,
till = false,
n_times = 1,
mode = nil,
jumping = false,
}
<
------------------------------------------------------------------------------
*MiniJump.jump()*
`MiniJump.jump`({target}, {backward}, {till}, {n_times})
Jump to target
Takes a string and jumps to its first occurrence in desired direction.
All default values are taken from |MiniJump.state| to emulate latest jump.
Parameters~
{target} `(string|nil)` The string to jump to.
{backward} `(boolean|nil)` Whether to jump backward.
{till} `(boolean|nil)` Whether to jump just before/after the match instead of
exactly on target. This includes positioning cursor past the end of
previous/current line. Note that with backward jump this might lead to
cursor being on target if can't be put past the line.
{n_times} `(number|nil)` Number of times to perform consecutive jumps.
------------------------------------------------------------------------------
*MiniJump.smart_jump()*
`MiniJump.smart_jump`({backward}, {till})
Make smart jump
If the last movement was a jump, perform another jump with the same target.
Otherwise, wait for a target input (via |getcharstr()|). Respects |v:count|.
All default values are taken from |MiniJump.state| to emulate latest jump.
Parameters~
{backward} `(boolean|nil)` Whether to jump backward.
{till} `(boolean|nil)` Whether to jump just before/after the match instead of
exactly on target. This includes positioning cursor past the end of
previous/current line. Note that with backward jump this might lead to
cursor being on target if can't be put past the line.
------------------------------------------------------------------------------
*MiniJump.expr_jump()*
`MiniJump.expr_jump`({backward}, {till})
Make expression jump
Cache information about the jump and return string with command to perform
jump. Designed to be used inside Operator-pending mapping (see
|omap-info|). Always asks for target (via |getcharstr()|). Respects |v:count|.
All default values are taken from |MiniJump.state| to emulate latest jump.
Parameters~
{backward} `(boolean|nil)` Whether to jump backward.
{till} `(boolean|nil)` Whether to jump just before/after the match instead of
exactly on target. This includes positioning cursor past the end of
previous/current line. Note that with backward jump this might lead to
cursor being on target if can't be put past the line.
------------------------------------------------------------------------------
*MiniJump.stop_jumping()*
`MiniJump.stop_jumping`()
Stop jumping
Removes highlights (if any) and forces the next smart jump to prompt for
the target. Automatically called on appropriate Neovim |events|.
------------------------------------------------------------------------------
*MiniJump.on_cursormoved()*
`MiniJump.on_cursormoved`()
Act on |CursorMoved|
vim:tw=78:ts=8:noet:ft=help:norl: