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

[PATCH] edit-command-line breaks arguments with spaces



In Functions/Zle/edit-command-line are these two lines:

  local editor=${${VISUAL:-${EDITOR:-vi}}}
  ${=editor} -c "normal! ${byteoffset}go" -- $1;;

In the second line $editor gets word-split. This is a problem in cases like:

  VISUAL='vim -c "set bufhidden=wipe"'

The word splitting splits the argument to -c in two pieces, "set, and bufhidden=wipe".

Here a small script that shows the difference and my suggestion of using eval:

  https://gist.github.com/mhinz/ec6f0363ac083ab80613148d39b28121

Marco

diff --git i/Functions/Zle/edit-command-line w/Functions/Zle/edit-command-line
index 353f2609a..5c82e823a 100644
--- i/Functions/Zle/edit-command-line
+++ w/Functions/Zle/edit-command-line
@@ -22 +22 @@
-      ${=editor} -c "normal! ${byteoffset}go" -- $1;;
+      eval "${editor[@]} -c 'normal! ${byteoffset}go' -- $1";;
@@ -25,2 +25,2 @@
-      ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;;
-    (*) ${=editor} $1;;
+      eval "${editor[@]} +${#lines}:$((${#lines[-1]} + 1)) $1";;
+    (*) eval "${editor[@]} $1";;



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