Commit 7066bf7c authored by Tristan Carel's avatar Tristan Carel
Browse files

Fix builtin `ecd' when file path contains space characters.

parent 574de93e
...@@ -31,13 +31,13 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then ...@@ -31,13 +31,13 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
$EDITOR --eval "$cmd" | tr -d \" $EDITOR --eval "$cmd" | tr -d \"
} }
# display the directory of the file # Write to standard output the directory of the file
# opened in the the current buffer # opened in the the current buffer
function ecd { function ecd {
local cmd="(let ((buf-name (buffer-file-name (window-buffer)))) local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
(if buf-name (file-name-directory buf-name)))" (if buf-name (file-name-directory buf-name)))"
local dir=`$EDITOR --eval "$cmd" | tr -d \"` local dir="$($EDITOR --eval $cmd | tr -d \")"
if [ -n "$dir" ] ;then if [ -n "$dir" ] ;then
echo "$dir" echo "$dir"
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment