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.

In bash , we can move back or forward by 1 word or character. Is there any option where i can move the cursor to the previous character that i specify, for example Forward Slash. ? Something like the f key stroke in vim which searches for the previous occurence of the following character?

share|improve this question

migrated from stackoverflow.com Mar 21 '13 at 8:34

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 3 down vote accepted

In Bash's emacs mode:

character-search (C-])

A character is read and point is moved to the next occurrence of that character. A negative count searches for previous occurrences.

character-search-backward (M-C-])

A character is read and point is moved to the previous occurrence of that character. A negative count searches for subsequent occurrences.

I'd recommend you use the vi mode and f works just like in the vi editor. You'll find it's very convenient for command line editing.

share|improve this answer
    
To switch between vi and emacs mode, use set -o vi or set -o emacs. –  whjm Mar 21 '13 at 7:12

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.