We help IT Professionals succeed at work.

Tab File Auto-Completion

thewing
thewing asked
on
Medium Priority
2,619 Views
Last Modified: 2013-12-06
Hi,
  I am aware that tab auto-completion of file names is a feature of the different shells, but what file do I edit to turn it on?I am working in TRU64 and HP-UX using mainly Korn shell, and this feature is disabled.Where do I go to turn it on?

Cheers
Ger
Comment
Watch Question

Commented:
Depending on the way you are using the ksh, it is assigned to different keys:

EMACS:
       complete ^[^[
              Automatically completes as much as is unique of the
              command name or the file name containing  the  cur-
              sor.   If the entire remaining command or file name
              is unique a space is printed after its  completion,
              unless  it  is  a directory name in which case / is
              appended.  If there is no command or file name with
              the  current  partial  word  as  its prefix, a bell
              character is output (usually causing a audio beep).

VI:
                   vi-tabcomplete  In vi command line editing, do
                                   command / file name completion
                                   when tab (^I)  is  entered  in
                                   insert mode.

                   vi-esccomplete  In vi command line editing, do
                                   command / file name completion
                                   when escape (^[) is entered in
                                   command mode.

try

set -o vi-tabcomplete and try
bas<TAB>

or

set -o emacs and try
bas<ESC><ESC>

Enjoy
K.

Author

Commented:
Tab Completion is on for emacs and vi.Where would I enter the above commands anyway?Command line?

It is for the command line that I want to turn on auto-complete.

Commented:
thewing

the 'set -o' commands kyrmit explained are for the command line! That means the examples he gave are used on the command line. ('set -o emacs' should do the trick for you, check your man pages for ksh).

======
Werner

Author

Commented:
Well I thought as much (must have come across as extremely blond there).I tried those commands.They did nothing for me.Isn't there a file I need to edit?
If you use set -o vi, on Compaq Tru64 Unix, type <esc>\ (escape followed by backslash).  On HP-UX type <esc><esc>.  These should do what you need them to do.  Hope this helps.

Author

Commented:
Esc causes the cursor to jump back one space.Nothing else happens?Is there an env that needs setting?

Commented:
Sorry, didn't want to make you blond :-)
I don't have access to your UNIX versions, but again your man pages should help you a bit ... the ksh page talks about the -o

======
Werner
Commented:
My appologise for using the non bastardised version of sun, et. al ;-)

It works a bit different on ksh for solaris and thus maybe for tru64?


$ksh -o vi
$ls
Benchmark              docs                              patchdiag.xref
Documents              expect.test                       patchk.pl
$ls Be<ESC>\
$ls Benchmark/

doesn't find commands in your path though. It works only by globbing, i.e. appending *.

Again, reading the man page (see COMPLETION) should give some insight.

Author

Commented:
Did the trick ;-) Cheers