-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathgrug-far.txt
248 lines (179 loc) · 9.83 KB
/
grug-far.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
*grug-far.txt* simple to use find and replace plugin
==============================================================================
CONTENTS *grug-far-contents*
1. Introduction ......................... |grug-far-introduction|
2. Setup ................................ |grug-far-setup|
3. Commands ............................. |grug-far-commands|
4. API .................................. |grug-far-api|
==============================================================================
1. INTRODUCTION *grug-far-introduction*
grug-far adds search/replace inside a buffer to neovim.
==============================================================================
2. SETUP *grug-far-setup*
Setup is way to override plugin options that apply to all instances of the
plugin. It's entirely optional.
require('grug-far').setup({ ... })
You can also do it like so if you prefer not calling a setup() function:
vim.g.grug_far = { ... }
==============================================================================
3. COMMANDS *grug-far-commands*
:GrugFar *GrugFar*
Opens up a grug-far buffer in a split. Multiple such buffers can
be opened, each with their potentially different searches and they will
show up in your buffers list. In visual mode, it will pre-fill search
with the current visual selection.
:GrugFarWithin *GrugFarWithin*
Same as :GrugFar, except that in visual mode, it will search and replace
within the range.
==============================================================================
4. API *grug-far-api*
require('grug-far').setup({config}) *grug-far.setup()*
Configures this plugin. Currently supported configuration options
are linked from the plugin's README page:
https://github.com/MagicDuck/grug-far.nvim/tree/main?tab=readme-ov-file#%EF%B8%8F-configuration
Parameters: ~
{config}(optional, table) Table of values; keys as described
above. Accept defaults by omitting the relevant key.
require('grug-far').open({config}) *grug-far.open()*
Launches grug-far, where the given config overrides the global plugin
config that was passed to require('grug-far).setup(...).
Currently supported configuration options are the same as the global
plugin config options linked above.
If the function is called while in visual mode, it will pre-fill
search with the current visual selection.
Parameters: ~
{config}(optional, table) Table of values; keys as described
above. Accept defaults by omitting the relevant key.
Return: ~
{instanceName}(string)
require('grug-far').with_visual_selection({config}) *grug-far.with_visual_selection()*
Launches grug-far, pre-filling search with the current visual
selection. The given config overrides the global plugin
config that was passed to require('grug-far).setup(...).
Currently supported configuration options are the same as the global
plugin config options linked above.
Parameters: ~
{config}(optional, table) Table of values; keys as described
above. Accept defaults by omitting the relevant key.
Return: ~
{instanceName}(string)
require('grug-far').toggle_instance({config}) *grug-far.toggle_instance()*
Toggles visibility of grug-far instance with the given config.instanceName.
If config.instanceName is nil, it operates on current buffer instance
if available.
The given config overrides the global plugin config that was passed to
require('grug-far).setup(...). Currently supported configuration options are
the same as the global plugin config options linked above.
Parameters: ~
{config}(optional, table) Table of values; keys as described
above. Accept defaults by omitting the relevant key.
require('grug-far').toggle_flags({flags}) *grug-far.toggle_flags()*
Toggles given list of flags in the current grug-far buffer. The
flags get added to/removed from the Flags input line.
e.g. require('grug-far).toggle_flags({'--fixed-strings'}).
Parameters: ~
{flags}(table) List of flag strings to toggle.
Return: ~
{flags_state}(table) List of boolean flag states
require('grug-far').has_instance({instanceName}) *grug-far.has_instance()*
Checks if grug-far instance with given name exists
Parameters: ~
{instanceName}(string)
Return: ~
{exists}(boolean)
require('grug-far').get_instance_name_by_buf({buf}) *grug-far.get_instance_name_by_buf()*
Returns instance name associated with given buf number.
if given buf number is 0, returns instance for current buffer.
Note that even grug far instances that are not specifically given an
instanceName, will have an automatically generated one.
Parameters: ~
{buf}(integer) buf number
Return: ~
{instanceName}(string) name of the instance
require('grug-far').is_instance_open({instanceName}) *grug-far.is_instance_open()*
Checks if grug-far instance with given name is open.
Parameters: ~
{instanceName}(string)
Return: ~
{is_open}(boolean)
require('grug-far').open_instance({instanceName}) *grug-far.open_instance()*
Opens grug-far instance with given name if window is closed.
Operates on current buffer instance if instaceName=nil.
Otherwise focuses the window.
Parameters: ~
{instanceName}(string?)
require('grug-far').close_instance({instanceName}) *grug-far.hide_instance()*
Closes window of grug-far instance with given name if window is open.
Operates on current buffer instance if instaceName=nil.
Parameters: ~
{instanceName}(string?)
require('grug-far').kill_instance({instanceName}) *grug-far.close_instance()*
Kills grug-far instance with given name.
Operates on current buffer instance if instaceName=nil.
Parameters: ~
{instanceName}(string?)
require('grug-far').update_instance_prefills({instanceName}, {prefills}, {clearOld})
*grug-far.update_instance_prefills()*
Updates grug-far instance with given input prefill.
Operates on current buffer instance if instaceName=nil.
If clearOld=true is given, the old input values are ignored.
Parameters: ~
{instanceName}(string?)
{prefills}(PrefillsTableOverride) table
{search=, replacement=, filesFilter=, flags=, paths=}
{clearOld}(boolean) if given, old input values are ignored
require('grug-far').get_current_visual_selection({strict})
*grug-far.get_current_visual_selection()*
Gets the current visual selection as a string.
This is provided as a utility for users so they don't have to rewrite.
Parameters: ~
{strict}(boolean) If true, only return selection if currently in
visual mode
Return: ~
{visual_selection}(string)
require('grug-far').get_current_visual_selection_lines({strict})
*grug-far.get_current_visual_selection_lines()*
Gets the current visual selection as a string array for each line.
This is provided as a utility for users so they don't have to rewrite.
Parameters: ~
{strict}(boolean) If true, only return selection if currently in
visual mode
Return: ~
{visual_selection}(string[])
require('grug-far').get_current_visual_selection_as_range_str({strict})
*grug-far.get_current_visual_selection_as_range_str()*
Gets the current visual selection as a range string representation.
Useful when passing as a prefill for Paths: input in some situations
where you would like to search and replace within a range.
Parameters: ~
{strict}(boolean) If true, only return selection string if currently in
visual mode
Return: ~
{range_str}(string)
require('grug-far').goto_input({inputName}, {instanceName}) *grug-far.goto_input()*
Moves cursor to input with given name.
Operates on given instance or current buffer instance if instaceName=nil.
Parameters: ~
{inputName}(string)
{instanceName}(string?)
require('grug-far').goto_first_input({instanceName}) *grug-far.goto_first_input()*
Moves cursor to first input.
Operates on given instance or current buffer instance if instaceName=nil.
Parameters: ~
{instanceName}(string?)
require('grug-far').goto_next_input({instanceName}) *grug-far.goto_next_input()*
Moves cursor to next input (based on current location). Cycles back.
Operates on given instance or current buffer instance if instaceName=nil.
Parameters: ~
{instanceName}(string?)
require('grug-far').goto_prev_input({instanceName}) *grug-far.goto_prev_input()*
Moves cursor to prev input (based on current location). Cycles back.
Operates on given instance or current buffer instance if instaceName=nil.
Parameters: ~
{instanceName}(string?)
==============================================================================
4. Highlights *grug-far-highlights*
Currently supported highlights are linked from the plugin's README page:
https://github.com/MagicDuck/grug-far.nvim/tree/main?tab=readme-ov-file#%EF%B8%8F-configuration
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: