mirror of
https://github.com/zsh-users/zsh
synced 2024-10-07 08:30:06 +00:00
13323: handle multi-line buffers in edit-command-line widget
This commit is contained in:
parent
5d60b66944
commit
39ab4f33c6
|
@ -1,3 +1,7 @@
|
|||
2001-02-14 Clint Adams <schizo@debian.org>
|
||||
|
||||
* 13323: Functions/Zle/edit-command-line: handle
|
||||
multi-line buffers.
|
||||
|
||||
2001-02-02 Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue