Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using the word split style shell (select-word-style shell). I like it in general but would like to split at forward slashes also, so that when I go forward/backward a word, if the word doesn't contain any /s, it completely skips over the word but if it does contain one or more slashes, it stops at the first slash.

Any ideas?

share|improve this question

1 Answer 1

man zshall /forward-word /backward-word

echo $WORDCHARS
*?_-.[]~=/&;!#$%^(){}<>
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'  ;# without /
share|improve this answer
1  
+1 I wonder why this is not the default. Paths are probably the single most used entity in a command line. –  Mischa Arefiev Sep 19 '12 at 10:51
    
A more succinct version is WORDCHARS=${WORDCHARS//[\/]}. –  James O'Gorman Sep 19 '12 at 14:24
4  
even shorter WORDCHARS=${WORDCHARS/\/} –  Nahuel Fouilleul Sep 19 '12 at 14:44
    
or WORDCHARS=$WORDCHARS:s:/: –  Stéphane Chazelas Nov 17 '12 at 21:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.