Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to change the definition of the word separators in bash? This will allow me, for example, to do ctrl+w (delete previous word) at the end of this path:

/some/path/of/some/file

and the effect will be that only "file" will be deleted, and not the whole path.

edit: to be more clear, word deletion is just one possible usage, but I'm interested in moving between words, etc. Also, I want to be able to configure underlines and other chars as separators, not only slash.

share|improve this question

2 Answers 2

You don't need to redefine or bind anything. Use Alt+Backspace to achieve the desired result.

See: http://www.math.utah.edu/docs/info/features_7.html

To move between words use Alt+b, Alt+f for b ack and f orward. This will also take _ as a seperator.

share|improve this answer
    
And how do I delete the next word, move between words, etc? –  user234741 Jun 30 '13 at 12:07

From Is it possible to configure ctrl-w (delete word)?:

You should be able to use Esc, then backspace to delete words delimited by slashes.

You can change this by putting this in you .bashrc:

bind '\C-f:unix-filename-rubout'

Now use Ctrl+f to do what you want.

share|improve this answer
    
thanks! would upvote if I had enough rep. This partially answers my question (please see my edit). –  user234741 Jun 30 '13 at 11:58

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.