You can use that:
nnoremap <key> :s//nextposition/g<c-b><right><right>
The mapping will first go into command mode: :
Then write s//nextposition/g
in the command lines
Go to the beginning of the command <c-b>
And move to the desired position: <right>
Some interesting command line mappings can be found here: :h cmdline-editing
Now about the part where you want to move the cursor to another place with <tab>
it is something that you can do in insert mode with a snippet engine like UltiSnips but I'm not sure you can make it work in command line.
Also not exactly related but Damian Conway has two pretty interesting mappings described in his how I vim:
First he says that to simplify his substitutions he created the following mapping:
nmap S :%s//g<LEFT><LEFT>
So he can press S
and then just pattern/replacement
to do the substitution.
Then to improve it he created the following:
nmap <expr> M ':%s/' . @/ . '//g<LEFT><LEFT>'
This way he can make a search /pattern
, see the results and simply type M
followed by the replacement string and the pattern is automatically added to the substitution command. (Note that it is convenient to see the pattern in the command but doing :%s//replacement/g
will also use the last search pattern)
I know that it is not what OP is asking for but I thought it could be an inspiration source.
<Left><left><Left>
. – romainl Aug 5 '16 at 6:03