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
This commit is contained in:
Jilles Tjoelker 2010-06-15 21:58:40 +00:00
parent 3d0f8bcd30
commit e46b12b732
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209221

View File

@ -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 {