Reputation: 1615
While navigating in BASH using VI mode, I can jump back to a specific character (e.g. '-') of the current command line via the following command:
F-
How can I jump back to a specific string (e.g. '--path') in the current command line of BASH? I know navigating in VI but I did not understand how to perform regex search in current command line of BASH.
Upvotes: 2
Views: 927
Reputation: 1269
According to here, what you want doesn't seem possible. The ?word
and /word
bindings search in command history rather than in the current command line.
But in vi mode, you can press ESC v
to open the current command line in an editor. Then you can edit & save the command and it will be executed (source).
Of course, as pointed out in nur-sh's answer, you can simply keep pressing B to get to the word.
Upvotes: 3
Reputation: 223
You could use the find command which searches backwards from where you are
?word
or you could keep pressing B to get to the word (this command goes back one Word at a time).
Upvotes: 0