Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Off-by-one with select-*-shell-word text object?



Noticed during recent zsh-users thread:

torch% quote-this-word() { zle select-in-shell-word; zle quote-region }
torch% zle -N quote-this-word
torch% bindkey "''" quote-this-word
torch% echo foo''
torch% echo' foo'

Note the left-quote has now included the space preceding the word.  I at
first suspected another vi-mode vs. emacs-mode difference, but:

torch% bindkey -v "''" quote-this-word
torch% bindkey -v
torch% echo foo''
torch% echo' foo'

Same effect for select-a-shell-word.  The right thing happens if I avoid
the *-shell-word variant:

torch% quote-this-word() { zle select-in-word; zle quote-region }
torch% echo foo''
torch% echo 'foo'

If including the preceding space is intentional, it should be mentioned
in the documentation.



Messages sorted by: Reverse Date, Date, Thread, Author