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

Re: Wishlist for zsh: 3 tcsh features

martin.ebourne@xxxxxxxxxxxx wrote:
>       1) <Meta-Del>: In tcsh, when deleting elements in a path,
>          <Meta-Del> generally deletes everything up to the next
>          "/" character, e.g.
> In ZSH this is controlled with the WORDCHARS env var. Mine is set to:
> WORDCHARS='*?_-.[]~#'

The trouble with changing the global WORDCHARS is that it then affects
every widget. I like `/' included for things like copy-prev-word but not
for word deletion so I use this:

tcsh-backward-delete-word() {
  local WORDCHARS="${WORDCHARS:s@/@}"
  zle backward-delete-word
zle -N tcsh-backward-delete-word

Zsh allows you to define your own widgets with shell functions like this
so you may be able to translate other things you're used to from tcsh.

>       3) <Meta-p>, part 2 : In tcsh, <Meta-p> will return the command that
>          matches exactly what's been typed already:
> The ZLE widgets 'history-beginning-search-backward' and '
> history-beginning-search-forward' are probably what you are after. I bind
> them to the up and down key since I find them by far the most useful way of
> accessing the history.

Those two widgets annoyingly don't allow you to navigate up and down in
multiple line commands so you may prefer to try `up-line-or-search' and
`down-line-or-search' which are similar. They also have their faults
though because they only use the first word on the current line in their
search. Ideally, these will be replaced with more primitive widgets
(e.g. just up-line) so that I can write one which works exactly as I
like in a shell function.


This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit

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