@@ -92,45 +92,25 @@ No keybindings are created by default. Below are the mappings to replace the
92
92
default ` w ` , ` e ` , and ` b ` motions with this plugin's version of them.
93
93
94
94
``` lua
95
- vim .keymap .set (
96
- { " n" , " o" , " x" },
97
- " w" ,
98
- " <cmd>lua require('spider').motion('w')<CR>" ,
99
- { desc = " Spider-w" }
100
- )
101
- vim .keymap .set (
102
- { " n" , " o" , " x" },
103
- " e" ,
104
- " <cmd>lua require('spider').motion('e')<CR>" ,
105
- { desc = " Spider-e" }
106
- )
107
- vim .keymap .set (
108
- { " n" , " o" , " x" },
109
- " b" ,
110
- " <cmd>lua require('spider').motion('b')<CR>" ,
111
- { desc = " Spider-b" }
112
- )
113
-
114
- -- OR: lazy-load on keystroke
115
- -- lazy.nvim
95
+ vim .keymap .set ({ " n" , " o" , " x" }, " w" , " <cmd>lua require('spider').motion('w')<CR>" )
96
+ vim .keymap .set ({ " n" , " o" , " x" }, " e" , " <cmd>lua require('spider').motion('e')<CR>" )
97
+ vim .keymap .set ({ " n" , " o" , " x" }, " b" , " <cmd>lua require('spider').motion('b')<CR>" )
98
+
99
+ -- OR: lazy-load on keystroke (lazy.nvim)
116
100
{
117
101
" chrisgrieser/nvim-spider" ,
118
102
keys = {
119
- {
120
- " e" ,
121
- " <cmd>lua require('spider').motion('e')<CR>" ,
122
- mode = { " n" , " o" , " x" },
123
- },
124
- -- ...
103
+ { " w" , " <cmd>lua require('spider').motion('w')<CR>" , mode = { " n" , " o" , " x" } },
104
+ { " e" , " <cmd>lua require('spider').motion('e')<CR>" , mode = { " n" , " o" , " x" } },
105
+ { " b" , " <cmd>lua require('spider').motion('b')<CR>" , mode = { " n" , " o" , " x" } },
125
106
},
126
107
},
127
108
```
128
109
129
- <!-- vale Google.Will = NO -->
130
110
> [ !NOTE]
131
111
> For dot-repeat to work, you have to call the motions as Ex-commands.
132
112
> Dot-repeat will not work when using `function() require("spider").motion("w")
133
- > end` as third argument,
113
+ > end` as third argument.
134
114
135
115
## Configuration
136
116
@@ -188,9 +168,7 @@ require("spider").motion("w", {
188
168
-- setting `overrideDefault` to false.
189
169
require (" spider" ).motion (" w" , {
190
170
customPatterns = {
191
- patterns = {
192
- (" %x" ):rep (6 ) .. " +" },
193
- },
171
+ patterns = { (" %x" ):rep (6 ) .. " +" } },
194
172
overrideDefault = false ,
195
173
},
196
174
})
@@ -244,20 +222,20 @@ camelCase, check out the `subword` text object of
244
222
### Operator-pending mode: the case of ` cw `
245
223
In operator pending mode, vim's ` web ` motions are actually a bit inconsistent.
246
224
For instance, ` cw ` will change to the * end* of a word instead of the start of
247
- the next word, like ` dw ` does. This is probably done for convenience in vi 's
225
+ the next word, like ` dw ` does. This is probably done for convenience in ` vi ` 's
248
226
early days before there were text objects. In my view, this is quite problematic
249
227
since it makes people habitualize inconsistent motion behavior.
250
228
251
229
In this plugin, such small inconsistencies are therefore deliberately not
252
230
implemented. Apart from the inconsistency, such a behavior can create unexpected
253
- results when used in subwords or near punctuation. If you nevertheless want to,
254
- you can achieve that behavior by mapping ` cw ` to ` ce ` :
231
+ results when used in subwords or near punctuation. If you nevertheless prefer
232
+ that behavior, you can achieve that behavior by mapping ` cw ` to ` ce ` :
255
233
256
234
``` lua
257
235
vim .keymap .set (" o" , " w" , " <cmd>lua require('spider').motion('w')<CR>" )
258
236
vim .keymap .set (" n" , " cw" , " ce" , { remap = true })
259
237
260
- -- or the same in one mapping without `remap = true`
238
+ -- OR in one mapping
261
239
vim .keymap .set (" n" , " cw" , " c<cmd>lua require('spider').motion('e')<CR>" )
262
240
```
263
241
@@ -295,7 +273,7 @@ would be yanked charwise.
295
273
** Caveats**
296
274
1 . Last visual selection marks (`` `[ `` and `` `] `` ) are updated
297
275
and point to the endpoints of the motion. This was not always the case before.
298
- 2 . Forced blockwise motion may be cancelled if it cannot be correctly
276
+ 2 . Forced blockwise motion may be canceled if it cannot be correctly
299
277
represented with the current ` selection ` option.
300
278
301
279
### Motions in insert mode
@@ -308,12 +286,12 @@ vim.keymap.set("i", "<C-b>", "<Esc><cmd>lua require('spider').motion('b')<CR>i")
308
286
```
309
287
310
288
## Credits
311
- ** Thanks**
289
+ ** Thanks**
312
290
- ` @vypxl ` and ` @ii14 ` [ for figuring out dot-repeatability of
313
291
textobjects] ( https://github.com/chrisgrieser/nvim-spider/pull/4 ) .
314
292
- ` @vanaigr ` for a large contribution regarding operator-pending mode.
315
293
316
- ** About the developer**
294
+ ** About the developer**
317
295
In my day job, I am a sociologist studying the social mechanisms underlying the
318
296
digital economy. For my PhD project, I investigate the governance of the app
319
297
economy and how software ecosystems manage the tension between innovation and
0 commit comments