fish_vi_key_bindings: add support for count - #12170
Conversation
8a80861 to
b93b604
Compare
|
probably worth a brief mention in the changelog |
c3da561 to
97049e1
Compare
|
I had to make an operator mode, similarly to vim, because otherwise, motions like |
62296db to
0008fa7
Compare
| set -g __fish_vi_start_count $__fish_vi_count | ||
| set -g __fish_vi_count | ||
| set fish_bind_mode operator | ||
| commandline -f repaint-mode |
There was a problem hiding this comment.
nice, the operator mode seems like the correct thing to do.
Typing "d2" with the default config shows that the default
fish_mode_prompt is empty.
Can you update that?
Searching for case replace_one finds three occurrences.
Maybe we should display the operator in context, so 'd' or 'c'
(but it should always be width one, to avoid jumping)
It also looks like typing only "d" does not repaint the mode?
Not sure what's up with that.
There was a problem hiding this comment.
Apparently for the mode to update, we need to have at least 3 inputs, and then it will update on the second, and when it's finished it will go back to normal.
For example dge or d2w makes it update the mode. But not 2dw for example
| set fish_bind_mode insert | ||
| case yank | ||
| for i in (seq $total) | ||
| commandline -f kill-whole-line yank |
There was a problem hiding this comment.
This doesn't seem to copy everything, only the last line (unless I tested wrong).
If we can't fix that we should at least acknowledge it with a TODO comment.
| bind -s --preset -M default d 'fish_vi_start_operator delete' | ||
| bind -s --preset -M default c 'fish_vi_start_operator change' | ||
| bind -s --preset -M default y 'fish_vi_start_operator yank' | ||
| bind -s --preset -M default \~ 'fish_vi_start_operator swap-case' |
There was a problem hiding this comment.
In future, we can add some more operators (as listed in Vim's :h operator) like gu/gU
| bind -s --preset -M default \~ 'fish_vi_start_operator swap-case' | ||
|
|
||
| bind -s --preset -M operator escape fish_vi_operator_cancel | ||
| bind -s --preset -M operator ctrl-\[ fish_vi_operator_cancel |
There was a problem hiding this comment.
(unrelated) our ctrl-c behavior is weirdly different from Vim; not sure if that's good
| bind -s --preset d,B backward-kill-bigword | ||
| bind -s --preset d,g,e backward-kill-word | ||
| bind -s --preset d,g,E backward-kill-bigword | ||
| bind -s --preset d,f begin-selection forward-jump kill-selection end-selection |
There was a problem hiding this comment.
I didn't review whether the set of binds is equivalent because they were moved.
If we want it to be easy to see if anything has been dropped or wrongly added, we should
- start with a commit that only moves lines, without other changes
- then add another commit that only replaces lines with new operations, and doesn't move them
but that's not necessary, just some food for thought
|
since you didn't make any manual changes to |
eb41fb6 to
5d9a221
Compare
5d9a221 to
877438d
Compare
877438d to
0c6b8bf
Compare
Description
Adds support for v:count in vi keybinds, also added functions for simplifying e/E definitions.
Adds a new operator mode for handling bindings such as
d3wFixes issue #2192
TODOs: