summaryrefslogtreecommitdiff
path: root/Functions/Misc/zed
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-06-05 11:21:22 +0100
committerPeter Stephenson <pws@zsh.org>2015-06-05 11:21:22 +0100
commit2abba7243a736a2fc626f3cc917d8a67014d4d20 (patch)
treec91850e5786a9a8e0c9ebbedc65abbc3a3131cd0 /Functions/Misc/zed
parent4804a7c5ff144fc7cc974484d16f2f88cc131264 (diff)
downloadzsh-2abba7243a736a2fc626f3cc917d8a67014d4d20.tar.gz
zsh-2abba7243a736a2fc626f3cc917d8a67014d4d20.zip
35386: expand tabs where useful in builtins outputing function.
Also add to zed -f. Option is -x <numm>.
Diffstat (limited to 'Functions/Misc/zed')
-rw-r--r--Functions/Misc/zed17
1 files changed, 13 insertions, 4 deletions
diff --git a/Functions/Misc/zed b/Functions/Misc/zed
index c2caaf3f5..010b69bee 100644
--- a/Functions/Misc/zed
+++ b/Functions/Misc/zed
@@ -9,8 +9,9 @@
local var opt zed_file_name
# We do not want timeout while we are editing a file
integer TMOUT=0 okargs=1 fun bind
+local -a expand
-while getopts "fb" opt; do
+while getopts "fbx:" opt; do
case $opt in
(f)
fun=1
@@ -19,6 +20,14 @@ while getopts "fb" opt; do
(b)
bind=1
;;
+
+ (x)
+ if [[ $OPTARG != <-> ]]; then
+ print -r "Integer expected after -x: $OPTARG" >&2
+ return 1
+ fi
+ expand=(-x $OPTARG)
+ ;;
esac
done
shift $(( OPTIND - 1 ))
@@ -29,8 +38,8 @@ shift $(( OPTIND - 1 ))
if (( $# != okargs )); then
echo 'Usage:
zed filename
-zed -f function
-zed -b'
+zed -f [ -x N ] function
+zed -b' >&2
return 1
fi
@@ -71,7 +80,7 @@ fi
setopt localoptions nobanghist
if ((fun)) then
- var="$(functions $1)"
+ var="$(functions $expand $1)"
# If function is undefined but autoloadable, load it
if [[ $var = *\#\ undefined* ]] then
var="$(autoload +X $1; functions $1)"