fish_vi_key_bindings: add 'ab' and 'ib' vi text object

Part of #1842

The implementation is obviously isn't 100% vi compatible, but works good enough
for major cases

This commit depends on previous commits where jump-{to, till}-matching-bracket
motions were introduces
This commit is contained in:
Nikita Bobko 2024-06-29 00:01:45 +02:00 committed by Peter Ammon
parent 67e190876a
commit e03e5e116d
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -182,6 +182,7 @@ New or improved bindings
- Added bindings for clipboard interaction, like :kbd:`",+,p` and :kbd:`",+,y,y`. - Added bindings for clipboard interaction, like :kbd:`",+,p` and :kbd:`",+,y,y`.
- Deleting in visual mode now moves the cursor back, matching vi (:issue:`10394`). - Deleting in visual mode now moves the cursor back, matching vi (:issue:`10394`).
- Support :kbd:`%` motion. - Support :kbd:`%` motion.
- Support `ab` and `ib` vi text objects. New input functions are introduced ``jump-{to,till}-matching-bracket`` (:issue:`1842`).
Completions Completions
^^^^^^^^^^^ ^^^^^^^^^^^

View File

@ -169,6 +169,8 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
bind -s --preset d,T begin-selection backward-jump forward-single-char kill-selection end-selection bind -s --preset d,T begin-selection backward-jump forward-single-char kill-selection end-selection
bind -s --preset d,h backward-char delete-char bind -s --preset d,h backward-char delete-char
bind -s --preset d,l delete-char bind -s --preset d,l delete-char
bind -s --preset d,i,b jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection
bind -s --preset d,a,b jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection
bind -s --preset d,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection bind -s --preset d,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection
bind -s --preset d,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection bind -s --preset d,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection
bind -s --preset 'd,;' begin-selection repeat-jump kill-selection end-selection bind -s --preset 'd,;' begin-selection repeat-jump kill-selection end-selection
@ -199,6 +201,8 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
bind -s --preset -m insert c,T begin-selection backward-jump forward-single-char kill-selection end-selection repaint-mode bind -s --preset -m insert c,T begin-selection backward-jump forward-single-char kill-selection end-selection repaint-mode
bind -s --preset -m insert c,h backward-char begin-selection kill-selection end-selection repaint-mode bind -s --preset -m insert c,h backward-char begin-selection kill-selection end-selection repaint-mode
bind -s --preset -m insert c,l begin-selection kill-selection end-selection repaint-mode bind -s --preset -m insert c,l begin-selection kill-selection end-selection repaint-mode
bind -s --preset -m insert c,i,b jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection
bind -s --preset -m insert c,a,b jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection
bind -s --preset -m insert c,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode bind -s --preset -m insert c,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode
bind -s --preset -m insert c,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode bind -s --preset -m insert c,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode
@ -235,6 +239,8 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
bind -s --preset y,T begin-selection backward-jump-till kill-selection yank end-selection bind -s --preset y,T begin-selection backward-jump-till kill-selection yank end-selection
bind -s --preset y,h backward-char begin-selection kill-selection yank end-selection bind -s --preset y,h backward-char begin-selection kill-selection yank end-selection
bind -s --preset y,l begin-selection kill-selection yank end-selection bind -s --preset y,l begin-selection kill-selection yank end-selection
bind -s --preset y,i,b jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection yank end-selection
bind -s --preset y,a,b jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection yank end-selection
bind -s --preset y,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection yank end-selection bind -s --preset y,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection yank end-selection
bind -s --preset y,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection yank end-selection bind -s --preset y,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection yank end-selection