Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2010 21:58:40 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209221 - head/bin/sh
Message-ID:  <201006152158.o5FLwerZ005440@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006152158.o5FLwerZ005440>