Vi move cursor to start of substitution command
If I am doing a long substitution, say:
:%s/<h3>.*<\/h3>/<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"><div class="panel panel-default"><div class="panel-heading" role="tab" id="headingOne"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="
collapseOne">\1<\/a><\/h4><\/div><div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">/
And I realize I forgot \(\)
around .*
, is there a way to move the cursor back to the beginning of the expression (like control-a on the command line)?
The home
and keys end
will move the beginning and end of the expression in the line editor.
You have minimal navigation with the arrow keys and Home/ Endon the command line, but for such huge commands, I prefer to switch to the command prompt window by clicking <C-F>
inside the command line, or type the command q:
instead :
. In this window, you can use all Vim commands to move and edit, and execute and execute through <Enter>
. See :help q:
.