1

I have vim keybindings enabled for command line editing by bindkey -v. When I am trying to use ci", ci', di" or di' it doesn't work.

For example: If I have a command echo "hello" 'world' and when I have the cursor on h and I press ci", it just sound a bip and doesn't do anything.

In command line editing other vim commands involving text objects like ciw, daw, cis etc. works fine.

If I open files in vim offcourse everything works including ci" and ci'.

Any idea what's going on here?

3

1 Answer 1

1

vi key binding provide a subset of legacy/POSIX vi editing features. All of the line editing libraries (with ability to select vi/emacs key-binding —e.g. GNU readline, zle, BSD libedit/editline, haskeline, etc.) have some limitations and are not (nor will be) a full Vi.

12
  • zsh doesn't use readline. Commented Jan 22, 2023 at 4:32
  • 1
    FWIW, readline and friends provide a "vi mode" anyway, not a "Vim mode". Vi didn't have text objects so there is no reason to expect a "vi mode" to have a Vim feature. Interestingly, some of them use vim-isms in their documentation ("insert mode", "operator-pending mode", etc.), which may hint at what their maintainers are actually looking at when working on the feature, but "vi mode" is still clearly labelled that way.
    – romainl
    Commented Jan 22, 2023 at 20:35
  • 1
    No one asked to "list all possible libraries". The question is about zsh, not readline or haskeline, or anything else. This question is off-topic here so it doesn't matter that much, but I'm reasonably sure ci" can be made to work with zsh without too much effort (maybe also readline? I'm less familiar with it). Actually, looking in to it the feature is bundled with zle, and just needs to be enabled. So yes, I'd say that linking to the correct documentation does matter. Commented Jan 23, 2023 at 3:21
  • 1
    It has "zsh" in the question title, so that's why I assumed it's a zsh question. It's not mentioned in the body though, and it's sometimes easy to miss if something is mentioned only in the title (I've done that anyway). Commented Jan 23, 2023 at 13:16
  • 1
    Oh my bad, you're right: I've missed Zsh mention in the title :( Many thanks for pointing that out @MartinTournoij (I realy need some rest...) I even though, because of bindkey -v that OP is a Tcsh user (when I gave Zsh a try, i didn't play with that command so forgot it doesn't go set -o vi) Anyway thanks for making me correct my answer.
    – gildux
    Commented Jan 23, 2023 at 19:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.