svn commit: r209221 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Tue Jun 15 21:58:40 UTC 2010


Author: jilles
Date: Tue Jun 15 21:58:40 2010
New Revision: 209221
URL: http://svn.freebsd.org/changeset/base/209221

Log:
  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

Modified:
  head/bin/sh/histedit.c

Modified: head/bin/sh/histedit.c
==============================================================================
--- head/bin/sh/histedit.c	Tue Jun 15 21:46:07 2010	(r209220)
+++ head/bin/sh/histedit.c	Tue Jun 15 21:58:40 2010	(r209221)
@@ -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 {


More information about the svn-src-head mailing list