Commit 3a69472
committed
fix: use :startinsert instead of feedkeys to switch to terminal mode
If user has their own `startinsert`, e.g. in the following case,
`startinsert` is trigger by `:term`, but later fzf term is focused.
```
nvim \
+"au TermOpen * startinsert" \
+"term" \
+"lua vim.defer_fn(function() vim.cmd [[FzfLua files]] end, 100)"
```
Technically user should not `startinsert` on an incorrect window, but
currently there's no way to avoid it since builtin `startinsert` seems
defered but `nvim_get_mode` is fast (return actual mode immediately).
This PR periodly retry `startinsert` until `nt` mode on fzf term buffer.
TODO: test1 parent 9a1f4b6 commit 3a69472
2 files changed
+21
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
337 | 336 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 337 | + | |
344 | 338 | | |
345 | 339 | | |
346 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1298 | 1298 | | |
1299 | 1299 | | |
1300 | 1300 | | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
1301 | 1321 | | |
1302 | 1322 | | |
1303 | 1323 | | |
| |||
0 commit comments