On Mon, Nov 03, 2008 at 12:37:02PM +0000, Peter Stephenson wrote:
Matthieu Louvel de Monceaux wrote:
When we return from command mode to insert mode, we can't modify
the text from the beginning to the spot where we got insert ...
Definitely a weird behavior ...
To get it too, just type 'foo folk x' for example.
Then Esc, type 'b' to go to the previous word, then press 'i' to go
insert mode.
Now you can't edit the 'foo ' part anymore.
I'm sorry, I don't understand.
[...]
I suspect he is refering to the traditional vi behavior of
vi-backward-delete-char documented in "info zsh 'Modifying
Text'"
vi-backward-delete-char (unbound) (X) (^H)
Delete the character behind the cursor, without changing lines.
If in insert mode, this won't delete past the point where insert
mode was last entered.
So I suspects he wants instead:
if (($+terminfo[kbs])); then
bindkey -M viins $terminfo[kbs] backward-delete-char
else
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^H' backward-delete-char
fi
(($+terminfo[kdch1])) &&
bindkey -M viins $terminfo[kdch1] delete-char
The above trys to map the emacs-style (as opposed to vi style)
backward-delete-char to the character sent by the backspace key
(using the terminfo database if it's there, or hardcoding both
^? and ^H). It also maps delete-char to the character sent by
the delete key if the terminfo database has that information.
Note that on a number of terminals, backspace sends ^H and
delete ^? while in a number of others backspace sends ^? and
delete something else like the sequence \e[3~