zsh-users
 help / color / mirror / code / Atom feed
* backward-dir/forward-dir
@ 2006-06-15 12:36 David Kulp
  2006-06-15 12:48 ` backward-dir/forward-dir Christian Taylor
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Kulp @ 2006-06-15 12:36 UTC (permalink / raw)
  To: zsh-users

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?

Thanks in advance.


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

* Re: backward-dir/forward-dir
  2006-06-15 12:36 backward-dir/forward-dir David Kulp
@ 2006-06-15 12:48 ` Christian Taylor
  2006-06-15 12:57 ` backward-dir/forward-dir Peter Stephenson
  2006-06-15 13:04 ` backward-dir/forward-dir Mikael Magnusson
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Taylor @ 2006-06-15 12:48 UTC (permalink / raw)
  To: zsh-users

> Is there a key binding that allows me to move forward or back to the  
> next slash in a file 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?

Actually, it's the other way round: the WORDCHARS parameter specifies which 
characters (in addition to alphanumeric characters) are considered part of 
words. It contains several characters that make sense by default, so I think 
your best course of action would be to just exclude slashes:

WORDCHARS=${WORDCHARS//\/}

mfg,
Christian


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

* Re: backward-dir/forward-dir
  2006-06-15 12:36 backward-dir/forward-dir David Kulp
  2006-06-15 12:48 ` backward-dir/forward-dir Christian Taylor
@ 2006-06-15 12:57 ` Peter Stephenson
  2006-06-15 13:04 ` backward-dir/forward-dir Mikael Magnusson
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2006-06-15 12:57 UTC (permalink / raw)
  To: zsh-users

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@csr.com>                  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


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

* Re: backward-dir/forward-dir
  2006-06-15 12:36 backward-dir/forward-dir David Kulp
  2006-06-15 12:48 ` backward-dir/forward-dir Christian Taylor
  2006-06-15 12:57 ` backward-dir/forward-dir Peter Stephenson
@ 2006-06-15 13:04 ` Mikael Magnusson
  2 siblings, 0 replies; 4+ messages in thread
From: Mikael Magnusson @ 2006-06-15 13:04 UTC (permalink / raw)
  To: David Kulp; +Cc: zsh-users

On 6/15/06, David Kulp <dkulp@cs.umass.edu> 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?
>
> Thanks in advance.

I don't quite remember where i got this from, but it does what you
want, http://mikachu.ath.cx/slask/dot-delete-to , if someone wants to
replicate it inline so it's archived go ahead, but i don't trust gmail
to get everything right.

-- 
Mikael Magnusson


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

end of thread, other threads:[~2006-06-15 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-15 12:36 backward-dir/forward-dir David Kulp
2006-06-15 12:48 ` backward-dir/forward-dir Christian Taylor
2006-06-15 12:57 ` backward-dir/forward-dir Peter Stephenson
2006-06-15 13:04 ` backward-dir/forward-dir Mikael Magnusson

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).