summaryrefslogtreecommitdiffstats
path: root/bin/sh/histedit.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-06-15 21:58:40 +0000
committerjilles <jilles@FreeBSD.org>2010-06-15 21:58:40 +0000
commit714627407c8f3537554ec37fbed5f17383327427 (patch)
tree0b7b116a6999eee9cceabc919a9d154c19ef0f8a /bin/sh/histedit.c
parent1babf0ea165658db31c411e8e666ba5453b8e1f0 (diff)
downloadFreeBSD-src-714627407c8f3537554ec37fbed5f17383327427.zip
FreeBSD-src-714627407c8f3537554ec37fbed5f17383327427.tar.gz
sh: Add filename completion.
This uses the new libedit completion function with quoting support. Unlike NetBSD, there is no 'set +o tabcomplete' option to disable completion. I do not see any reason for such a special treatment, as completion is rather useful and it is possible to do bind ^I ed-insert to disable completion and insert a tab character instead. Submitted by: Guy Yur
Diffstat (limited to 'bin/sh/histedit.c')
-rw-r--r--bin/sh/histedit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 521c6f7..b76d73d 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -119,6 +119,9 @@ histedit(void)
if (hist)
el_set(el, EL_HIST, history, hist);
el_set(el, EL_PROMPT, getprompt);
+ el_set(el, EL_ADDFN, "sh-complete",
+ "Filename completion",
+ _el_fn_sh_complete);
} else {
bad:
out2fmt_flush("sh: can't initialize editing\n");
@@ -135,6 +138,7 @@ bad:
el_set(el, EL_EDITOR, "vi");
else if (Eflag)
el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_BIND, "^I", "sh-complete", NULL);
el_source(el, NULL);
}
} else {
OpenPOWER on IntegriCloud