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?
1 Answer
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.
To switch between vi
and emacs
mode, use set -o vi
or set -o emacs
.