is it possible to edit more than one word simultaneously, which are on the same line?

For example, let's say I have this:

Spam and Eggs is all you need for a healthy breakfast

and I would like to change the line to:

organic_Spam and organic_Eggs is all you need for a healthy breakfast

I would like to highlight "Spam" and "Eggs" and prepend "organic_" simultaneously to "Spam" and "Eggs". A bit like using visual block to write simultaneously on different lines, but here write stuff on the same line. I saw a colleague doing this with Sublime Text, and tried googling but to no avail.


3 Answers 3


I agree with Alexander here. In day to day editing I would probably use the . command as well, but if you want to execute just one command I would use the substitute command:


whereas the & is the matched pattern from /S\|E/.


In Vim there are no multi-cursors like in Sublime Text (but there are some plugins as I remember). But it seeems not so important stuff for vim because there is another way to achieve this. For example you have this line

Spam and Eggs is all you need for a healthy breakfast

I would doing something like this: place cursor in normal mode on the first letter of the Spam and enter iorganic_Esc, then two times w to jump on the Eggs and press . (dot) to repeat last action. So for me this is a lot more productive than in Sumlime Text but maybe not so fancy and intuitively though.

Anyway there is somekind of preprocessing stuff for this action in both editors, in Sublime Text is a selecting places for new multi-cursor position with some hotkey, and after all of this you can edit words simultaneously. In Vim this kind of "preprocessing" happens actually at time of editing of the line, I mean all of this ww. stuff.


If you really want multiple cursor support like Sublime, you can use this plugin: https://github.com/terryma/vim-multiple-cursors

It's not the vim way, but I use it often and it works well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.