1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

13323: handle multi-line buffers in edit-command-line widget

This commit is contained in:
Clint Adams 2001-02-14 15:37:53 +00:00
parent 5d60b66944
commit 39ab4f33c6
2 changed files with 10 additions and 3 deletions

View file

@ -3,15 +3,18 @@
# autoload edit-command-line
# zle -N edit-command-line
# bindkey -M vicmd v edit-command-line
# will give ksh-like behaviour for that key.
# will give ksh-like behaviour for that key,
# except that it will handle multi-line buffers properly.
local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
print -R - "$BUFFER" >$tmpfile
print -R - "$PREBUFFER$BUFFER" >$tmpfile
exec </dev/tty
${VISUAL:-${EDITOR:-vi}} $tmpfile
BUFFER="$(<$tmpfile)"
zle kill-buffer
BUFFER=${"$(<$tmpfile)"/$PREBUFFER/}
CURSOR=$#BUFFER
command rm -f $tmpfile
zle redisplay