Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Automatically completing commands (and directiories) with <return>



I'd like to enhance the idea from my previous thread.  Aussuming
I have the autocd option set I would like to code the following
behaviour

-- BEGIN idea
IF

  The user types a command line, hits <return> and the first word
  does not resolve to a file or directory name (this does not apply
  if the file of directory exists but has unsuitable permissions):

THEN

  Zsh attempts to complete the first work just as if the cursor was
  at the end of the partial first word and the user had pressed
  <tab>.  After that:

  IF

    There is only one possible completion for the first word,

  THEN

    complete it automatically and execute the command line
    immediately.  (It might be worthwhile to not execute
    immediately but allow the user to review the completed word
    and let her edit the line if necessary or execute it by
    pressing <return> again.)

  ELSE

    Put the cursor right after the partial first word and begin
    completion just as if the user had pressed the <tab> key.
-- END idea

You could just type

  ./co<return>

to execute "./command-with-a-very-long-name", or

  ./di<return>

to cd into "./directory-with-a-very-long-name".

Anyway, I'm not exactly sure if you really win anything over typing

  ./co<tab><return>

though.  Hmmm.

Ciao

Dominik ^_^  ^_^



Messages sorted by: Reverse Date, Date, Thread, Author