zsh-users
 help / color / mirror / code / Atom feed
* Completion Guru needed (next/prev)
@ 1999-02-22 14:38 David R. Favor
  1999-02-22 15:05 ` Sven Wischnowsky
  0 siblings, 1 reply; 3+ messages in thread
From: David R. Favor @ 1999-02-22 14:38 UTC (permalink / raw)
  To: Zsh User's List

I'm trying to create a next/prev completion facility to quickly
traverse complicated directory hierarchies.

Here is an example hierarchy:

   ./src
   ./src/tools
   ./src/lib
   ./src/client
   ./src/server
   ./src/server/a
   ./src/server/b
   ./src/server/c
   ./doc
   ./doc/unix
   ./doc/html
   ./doc/ps
   ./info

Typing cd-SPACE-TAB begins completion of the directories [src doc info]. Here's
what I'm trying to do.

NEXT completion:

If src is currently seleted, normally it requires hitting BACKSPACE-TAB-TAB to
begin selecting directories [client lib server tools]. I would like to be able
to do this by hitting the shortcut SHIFT-TAB.

PREVIOUS completion:

If src/server/ is currently selected, I would like to be able to hit CNTL-TAB
to go back to selecting [client lib server tools]

Suggestions would be appreciated.

Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion Guru needed (next/prev)
@ 1999-02-22 15:05 ` Sven Wischnowsky
  1999-02-28  3:39   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-02-22 15:05 UTC (permalink / raw)
  To: zsh-users; +Cc: David R. Favor


David R. Favor wrote:

> I'm trying to create a next/prev completion facility to quickly
> traverse complicated directory hierarchies.
> 
> Here is an example hierarchy:
> 
> ...
> 
> Typing cd-SPACE-TAB begins completion of the directories [src doc info]. Here's
> what I'm trying to do.
> 
> NEXT completion:
> 
> If src is currently seleted, normally it requires hitting BACKSPACE-TAB-TAB to
> begin selecting directories [client lib server tools]. I would like to be able
> to do this by hitting the shortcut SHIFT-TAB.
> 
> PREVIOUS completion:
> 
> If src/server/ is currently selected, I would like to be able to hit CNTL-TAB
> to go back to selecting [client lib server tools]
> 
> Suggestions would be appreciated.

No official version allows to do this in the completion code. But you
can probably use some bindkey-trickery:

  bindkey -s <SHIFT-TAB> '^H^I^I'
  bindkey -s <CTRL-TAB>  '^W^I'

This will only work if there is no `/' in your WORDCHARS parameter and 
if Control-W is bound to bachward-kill-word or backword-delete-word
(it's normally bound to backward-kill-word). Maybe I understood you
wrong and in the second case '^W^W^I' does what you want.

Bye
 Sven

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion Guru needed (next/prev)
  1999-02-22 15:05 ` Sven Wischnowsky
@ 1999-02-28  3:39   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-02-28  3:39 UTC (permalink / raw)
  To: David R. Favor, zsh-users

On Feb 22,  8:38am, David R. Favor wrote:
} Subject: Completion Guru needed (next/prev)
}
} Typing cd-SPACE-TAB begins completion of the directories [src doc info].
} 
} NEXT completion:
} 
} If src is currently seleted, normally it requires hitting BACKSPACE-TAB-TAB
} to begin selecting directories [client lib server tools].

Actually, hitting SLASH TAB should do it if you setopt autoremoveslash.
In some buggy versions that will still leave you with src// on the line.

} I would like to be able to do this by hitting the shortcut SHIFT-TAB.

You'll have to use bindkey as Sven suggested -- but that assumes that a
shifted tab is actually distinguishable at the tty input level from a
plain tab, which in my experience it usually is not.
 
} PREVIOUS completion:
} 
} If src/server/ is currently selected, I would like to be able to hit
} CNTL-TAB to go back to selecting [client lib server tools]

Again, frequently the tty driver can't distinguish Ctrl-TAB from TAB, so
you may be out of luck.  (This has nothing to do with zsh itself.)

On Feb 22,  4:05pm, Sven Wischnowsky wrote:
} Subject: Re: Completion Guru needed (next/prev)
}
}   bindkey -s <SHIFT-TAB> '^H^I^I'
}   bindkey -s <CTRL-TAB>  '^W^I'
} 
} This will only work if there is no `/' in your WORDCHARS parameter and 
} if Control-W is bound to bachward-kill-word or backword-delete-word

Bind something to vi-backward-kill-word and then use that something in 
place of ^W, and then you won't have to worry about WORDCHARS.

} (it's normally bound to backward-kill-word). Maybe I understood you
} wrong and in the second case '^W^W^I' does what you want.

You probably need two word kills if autoremoveslash is NOT set, but only
one if autoremoveslash is set.  Unfortunately this may again depend on
what version of zsh it is.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-02-28  3:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-22 14:38 Completion Guru needed (next/prev) David R. Favor
1999-02-22 15:05 ` Sven Wischnowsky
1999-02-28  3:39   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).