From e03e5e116dca6afadf2cd72f399e0c5ac9268f65 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Sat, 29 Jun 2024 00:01:45 +0200 Subject: [PATCH] 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 --- CHANGELOG.rst | 1 + share/functions/fish_vi_key_bindings.fish | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e72c6209f..85f110ed4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -182,6 +182,7 @@ New or improved bindings - 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`). - Support :kbd:`%` motion. + - Support `ab` and `ib` vi text objects. New input functions are introduced ``jump-{to,till}-matching-bracket`` (:issue:`1842`). Completions ^^^^^^^^^^^ diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index c7ecc9c85..b45ca4b56 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -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,h backward-char 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,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 @@ -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,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,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,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,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,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,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection yank end-selection