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

Re: backward-dir/forward-dir



David Kulp wrote:
> Is there a key binding that allows me to move forward or back to the  
> next slash in a file path?
> 
> In emacs shell mode, M-b and M-f will move the cursor to the next  
> level of a /long/path/to/file.
> In zsh, M-b and M-f jump over the entire path.  But I usually want to  
> make a small edit in an existing path.
> 
> Strangely, I have noticed that ":" also serves as a word delimiter,  
> so M-b or M-f will stop on the colon for host:/path.  So that  
> suggests to me that there's a set of word delimiters defined somewhere?

Yes, it's in the parameter WORDCHARS (described in the zshparam manual and
referred to under forward-word but nowhere else in the zshzle manual).
Remove "/" to get the behaviour you want.

WORDCHARS=${WORDCHARS/\/}

If you'd like a more configurable way of doing this (having different
functions that either do or don't use / as a character in a word) see
the entry for the set of functions forward-word-match etc. in the
zshcontrib manual page.

(A while ago we were thinking about some contextual way of doing this so
that it would make /'s delimiters in file names, but nothing much came
of it.)

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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