From e46b12b732ef1cf8751a60c6571b475421534454 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 15 Jun 2010 21:58:40 +0000 Subject: [PATCH] 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 --- bin/sh/histedit.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 521c6f793cca..b76d73d6583a 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 @@ histedit(void) 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 {