pi-vim 0.1.3 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -68
- package/index.ts +576 -190
- package/motions.ts +122 -25
- package/package.json +4 -2
- package/word-boundary-cache.ts +24 -9
package/README.md
CHANGED
|
@@ -50,34 +50,62 @@ Insert-mode shortcuts (stay in Insert mode):
|
|
|
50
50
|
|
|
51
51
|
### Navigation (Normal mode)
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
|
56
|
-
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
|
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
|
|
|
65
|
-
| `
|
|
53
|
+
A `{count}` prefix can be prepended to any navigation key (max: `9999`).
|
|
54
|
+
|
|
55
|
+
| Key | Action |
|
|
56
|
+
|---------------|-------------------------------|
|
|
57
|
+
| `h` | Left |
|
|
58
|
+
| `l` | Right |
|
|
59
|
+
| `j` | Down |
|
|
60
|
+
| `k` | Up |
|
|
61
|
+
| `{count}h/l` | Move left/right `{count}` cols |
|
|
62
|
+
| `{count}j/k` | Move down/up `{count}` lines (clamped to buffer size) |
|
|
63
|
+
| `0` | Line start |
|
|
64
|
+
| `$` | Line end |
|
|
65
|
+
| `gg` | Buffer start (line 1) |
|
|
66
|
+
| `G` | Buffer end (last line) |
|
|
67
|
+
| `w` | Next `word` start (keyword/punctuation aware) |
|
|
68
|
+
| `b` | Previous `word` start |
|
|
69
|
+
| `e` | `word` end (inclusive) |
|
|
70
|
+
| `W` | Next `WORD` start (whitespace-delimited token) |
|
|
71
|
+
| `B` | Previous `WORD` start |
|
|
72
|
+
| `E` | `WORD` end (inclusive) |
|
|
73
|
+
| `{count}w/b/e`| Move `{count}` `word` motions |
|
|
74
|
+
| `{count}W/B/E`| Move `{count}` `WORD` motions |
|
|
75
|
+
| `}` | Move to next paragraph start (line start col `0`) |
|
|
76
|
+
| `{` | Move to previous paragraph start (line start col `0`) |
|
|
77
|
+
| `{count}}` | Repeat `}` `{count}` times |
|
|
78
|
+
| `{count}{` | Repeat `{` `{count}` times |
|
|
79
|
+
|
|
80
|
+
`word` (`w/b/e`) splits punctuation from keyword chars. `WORD` (`W/B/E`)
|
|
81
|
+
treats any non-whitespace run as one token (`foo-bar`, `path/to`, `x.y`).
|
|
82
|
+
|
|
83
|
+
Paragraph boundary definition (this extension wave):
|
|
84
|
+
- blank line: matches `^\s*$`
|
|
85
|
+
- paragraph start: non-blank line at BOF, or non-blank line immediately after a blank line
|
|
86
|
+
|
|
87
|
+
Standalone `{` / `}` motions are navigation-only (no text/register mutation).
|
|
88
|
+
Counted forms (`{count}{`, `{count}}`) step paragraph-by-paragraph.
|
|
89
|
+
If no further paragraph boundary exists, motions clamp at BOF/EOF.
|
|
90
|
+
Operator forms with braces (`d{`, `d}`, `c{`, `c}`, `y{`, `y}`) are out of scope for this wave.
|
|
66
91
|
|
|
67
92
|
---
|
|
68
93
|
|
|
69
94
|
### Character-find motions (Normal mode)
|
|
70
95
|
|
|
71
|
-
|
|
72
|
-
|------------|------------------------------------------------|
|
|
73
|
-
| `f{char}` | Jump forward to `char` (inclusive) |
|
|
74
|
-
| `F{char}` | Jump backward to `char` (inclusive) |
|
|
75
|
-
| `t{char}` | Jump forward to one before `char` (exclusive) |
|
|
76
|
-
| `T{char}` | Jump backward to one after `char` (exclusive) |
|
|
77
|
-
| `;` | Repeat last `f/F/t/T` motion |
|
|
78
|
-
| `,` | Repeat last motion in reverse direction |
|
|
96
|
+
A `{count}` prefix finds the Nth occurrence of `{char}` on the line.
|
|
79
97
|
|
|
80
|
-
|
|
98
|
+
| Key | Action |
|
|
99
|
+
|------------------|------------------------------------------------|
|
|
100
|
+
| `f{char}` | Jump forward to `char` (inclusive) |
|
|
101
|
+
| `F{char}` | Jump backward to `char` (inclusive) |
|
|
102
|
+
| `t{char}` | Jump forward to one before `char` (exclusive) |
|
|
103
|
+
| `T{char}` | Jump backward to one after `char` (exclusive) |
|
|
104
|
+
| `{count}f{char}` | Jump to Nth occurrence of `char` forward |
|
|
105
|
+
| `;` | Repeat last `f/F/t/T` motion |
|
|
106
|
+
| `,` | Repeat last motion in reverse direction |
|
|
107
|
+
|
|
108
|
+
Char-find motions compose with operators: `df{char}`, `ct{char}`, `d{count}t{char}`, etc.
|
|
81
109
|
|
|
82
110
|
---
|
|
83
111
|
|
|
@@ -88,47 +116,65 @@ All operators write to the unnamed register and mirror to the system clipboard
|
|
|
88
116
|
|
|
89
117
|
#### Delete `d{motion}` / `dd`
|
|
90
118
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
|
95
|
-
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
119
|
+
A `{count}` or dual-count prefix (`{pfx}d{op}{motion}`) is supported for
|
|
120
|
+
word, char-find, and linewise motions. Maximum total count: `9999`.
|
|
121
|
+
|
|
122
|
+
| Command | Deletes |
|
|
123
|
+
|-------------------|-----------------------------------------------------------|
|
|
124
|
+
| `dw` | Forward to next `word` start (exclusive, can cross lines) |
|
|
125
|
+
| `de` | Forward to `word` end (inclusive, can cross lines) |
|
|
126
|
+
| `db` | Backward to `word` start (exclusive, can cross lines) |
|
|
127
|
+
| `dW` | Forward to next `WORD` start (exclusive, can cross lines) |
|
|
128
|
+
| `dE` | Forward to `WORD` end (inclusive, can cross lines) |
|
|
129
|
+
| `dB` | Backward to `WORD` start (exclusive, can cross lines) |
|
|
130
|
+
| `d{count}w/e/b` | Forward/backward `{count}` `word` motions |
|
|
131
|
+
| `d{count}W/E/B` | Forward/backward `{count}` `WORD` motions |
|
|
132
|
+
| `d$` | To end of line |
|
|
133
|
+
| `d0` | To start of line |
|
|
134
|
+
| `dd` | Current line (linewise) |
|
|
135
|
+
| `{count}dd` | `{count}` lines (linewise) |
|
|
136
|
+
| `d{count}j` | Current line + `{count}` lines below (linewise) |
|
|
137
|
+
| `d{count}k` | Current line + `{count}` lines above (linewise) |
|
|
138
|
+
| `dG` | Current line to end of buffer (linewise) |
|
|
139
|
+
| `df{char}` | To and including `char` |
|
|
140
|
+
| `d{count}f{char}` | To and including Nth `char` |
|
|
141
|
+
| `dt{char}` | Up to (not including) `char` |
|
|
142
|
+
| `dF{char}` | Backward to and including `char` |
|
|
143
|
+
| `dT{char}` | Backward to one after `char` |
|
|
144
|
+
| `diw` | Inner word |
|
|
145
|
+
| `daw` | Around word (includes surrounding spaces) |
|
|
146
|
+
| `d{count}aw` | Around `{count}` words |
|
|
109
147
|
|
|
110
148
|
#### Change `c{motion}` / `cc`
|
|
111
149
|
|
|
112
|
-
Same motion set as `d`. Deletes text then enters Insert mode.
|
|
113
|
-
|
|
114
|
-
| Command
|
|
115
|
-
|
|
116
|
-
| `cw`
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `c
|
|
121
|
-
|
|
|
150
|
+
Same motion and count set as `d`. Deletes text then enters Insert mode.
|
|
151
|
+
|
|
152
|
+
| Command | Action |
|
|
153
|
+
|-----------------|------------------------------------|
|
|
154
|
+
| `cw` | Change `word` + Insert |
|
|
155
|
+
| `ce` / `cb` | Change to `word` end / previous `word` start |
|
|
156
|
+
| `cW` | Change `WORD` + Insert (`cW` on non-space behaves like `cE`) |
|
|
157
|
+
| `cE` / `cB` | Change to `WORD` end / previous `WORD` start |
|
|
158
|
+
| `c{count}w/e/b` | Change `{count}` `word` motions + Insert |
|
|
159
|
+
| `c{count}W/E/B` | Change `{count}` `WORD` motions + Insert |
|
|
160
|
+
| `ciw` | Change inner word |
|
|
161
|
+
| `caw` | Change around word |
|
|
162
|
+
| `cc` | Delete line content + Insert |
|
|
163
|
+
| `c$` | Delete to EOL + Insert |
|
|
164
|
+
| … | All `d` motions apply |
|
|
122
165
|
|
|
123
166
|
#### Single-key edits
|
|
124
167
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
|
128
|
-
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
168
|
+
A `{count}` prefix is supported for `x`, `p`, `P`. Maximum: `9999`.
|
|
169
|
+
|
|
170
|
+
| Key | Action |
|
|
171
|
+
|--------------|---------------------------------------------------------------|
|
|
172
|
+
| `x` | Delete char under cursor (no-op at/past EOL) |
|
|
173
|
+
| `{count}x` | Delete `{count}` chars |
|
|
174
|
+
| `s` | Delete char under cursor + Insert mode |
|
|
175
|
+
| `S` | Delete line content + Insert mode |
|
|
176
|
+
| `D` | Delete cursor to EOL (captures `\n` if at EOL with next line) |
|
|
177
|
+
| `C` | Delete cursor to EOL + Insert mode |
|
|
132
178
|
|
|
133
179
|
---
|
|
134
180
|
|
|
@@ -143,23 +189,32 @@ Same motion set as `d`. Writes to register, **no text mutation**.
|
|
|
143
189
|
| `y{count}j` | Current line + `{count}` lines below (linewise) |
|
|
144
190
|
| `y{count}k` | Current line + `{count}` lines above (linewise) |
|
|
145
191
|
| `yG` | Current line to end of buffer (linewise) |
|
|
146
|
-
| `yw` | Forward to next word start
|
|
147
|
-
| `ye` | To word end (inclusive)
|
|
148
|
-
| `yb` | Backward to word start
|
|
192
|
+
| `yw` | Forward to next `word` start |
|
|
193
|
+
| `ye` | To `word` end (inclusive) |
|
|
194
|
+
| `yb` | Backward to `word` start |
|
|
195
|
+
| `yW` | Forward to next `WORD` start |
|
|
196
|
+
| `yE` | To `WORD` end (inclusive) |
|
|
197
|
+
| `yB` | Backward to `WORD` start |
|
|
149
198
|
| `y$` | To end of line |
|
|
150
199
|
| `y0` | To start of line |
|
|
151
200
|
| `yf{c}` | To and including `char` |
|
|
152
201
|
| `yiw` | Inner word |
|
|
153
202
|
| `yaw` | Around word (includes spaces) |
|
|
154
203
|
|
|
204
|
+
Counted yank caveat: counted `word`/`WORD` yank motions are intentionally not
|
|
205
|
+
implemented (`y2w`, `2yw`, `y2W`, `2yW`, etc. cancel the pending operator).
|
|
206
|
+
Linewise counted yank (`{count}yy`, `y{count}j/k`) remains supported.
|
|
207
|
+
|
|
155
208
|
---
|
|
156
209
|
|
|
157
210
|
### Put / Paste
|
|
158
211
|
|
|
159
|
-
| Key
|
|
160
|
-
|
|
161
|
-
| `p`
|
|
162
|
-
| `P`
|
|
212
|
+
| Key | Action |
|
|
213
|
+
|--------------|-------------------------------------------------------------|
|
|
214
|
+
| `p` | Put after cursor (char-wise) / new line below (line-wise) |
|
|
215
|
+
| `P` | Put before cursor (char-wise) / new line above (line-wise) |
|
|
216
|
+
| `{count}p` | Put `{count}` times after cursor |
|
|
217
|
+
| `{count}P` | Put `{count}` times before cursor |
|
|
163
218
|
|
|
164
219
|
Put reads from the **unnamed register** (not OS clipboard).
|
|
165
220
|
Line-wise detection: register content ending in `\n` is treated as line-wise.
|
|
@@ -193,18 +248,18 @@ Redo (`<C-r>`) is **not implemented** — see [Out of scope](#out-of-scope).
|
|
|
193
248
|
| Area | This extension | Full Vim |
|
|
194
249
|
|-----------------------|----------------------------------------|-------------------------------|
|
|
195
250
|
| `$` motion | Moves past last char (readline CTRL+E) | Moves to last char |
|
|
196
|
-
| `w` / `e` / `b`
|
|
251
|
+
| `w` / `e` / `b` + `W` / `E` / `B` | Cross-line for `word` + `WORD` motions | Cross-line |
|
|
197
252
|
| `0` / `$` operators | Exclusive of anchor col | `0` inclusive of col 0 |
|
|
198
253
|
| Undo depth | Delegates to underlying readline undo | Full per-change undo tree |
|
|
199
254
|
| Redo | Not implemented | `<C-r>` |
|
|
200
255
|
| Visual mode | Not implemented | `v`, `V`, `<C-v>` |
|
|
201
256
|
| Text objects | Supports `iw`/`aw` only | Full text-object set |
|
|
202
|
-
| Count prefix |
|
|
257
|
+
| Count prefix | Supported for operators, word/char motions, navigation, and edits (`x`, `p`/`P`); capped at `MAX_COUNT=9999` to prevent abuse | Full support |
|
|
203
258
|
| Named registers | Not implemented (`"a`, etc.) | Supported |
|
|
204
259
|
| Macros | Not implemented (`q`, `@`) | Supported |
|
|
205
260
|
| Search | Not implemented (`/`, `?`, `n`, `N`) | Supported |
|
|
206
261
|
| Ex commands | Not implemented (`:s`, `:g`, etc.) | Supported |
|
|
207
|
-
| Multi-line operators | Supports `d/y` with `w/e/b`, `j/k` counts
|
|
262
|
+
| Multi-line operators | Supports `d/c/y` with `w/e/b` and `W/E/B`, plus `j/k` counts and `G`; not full Vim motion matrix | Rich cross-line semantics |
|
|
208
263
|
|
|
209
264
|
---
|
|
210
265
|
|
|
@@ -219,7 +274,7 @@ These are **explicitly deferred** and not planned for this feature:
|
|
|
219
274
|
- Ex command surface (`:s`, `:g`, `:r`, …)
|
|
220
275
|
- Search mode (`/`, `?`, `n`, `N`)
|
|
221
276
|
- Repeat (`.`)
|
|
222
|
-
-
|
|
277
|
+
- Extended count prefix beyond currently supported motions (e.g. counted `gg`, `:`, global operator counts)
|
|
223
278
|
- Redo (`<C-r>`) — no native redo primitive in the underlying readline editor;
|
|
224
279
|
deferred until a suitable hook is available.
|
|
225
280
|
- Window / tab / buffer management
|