Sublime Text was my favourite text editor, I’ve been following it since its early days. The feature I most liked and can’t live without is the multiple cursors selection. Sublime Text lets you to select and edit string on multiple place at once based on pattern that you defined. I think it was a pain killer feature. The thing was that I always want to go back to Vim. The day I found this repository (https://github.com/terryma/vim-multiple-cursors), I switched back to Vim. vim-multiple-cursors
is easy and intuitive as Sublime Text’s althought it’s a bit different in usage. But nowdays vim-multiple-cursors
has been broken, especially on the latest Vim release.
I were wondering if there is a way to do the same things with Vim’s internal command. Tada yada thanks to https://vim.fandom.com/wiki/Vim_Tips_Wiki. Not very intuitive as Sublime Text’s or vim-multiple-cursors
but it works as intended. Actually it is not a multiple cursors thing, still and all it achieved the same as multiple cursors feature. It’s more like a multiple replay.
Vertical multiple replay
Ctrl+v
to vertical select your lines, usejj
to expand your selection.- Hit
Shift+i
then type the string you want to insert. - Pres
Escape
, the inserted text will be appears on all lines.
Multiple replay by pattern
- Search your string with
/stringyouwanttomark
- Type
cgn
then type the new string. - Hit
Ctrl-c
to exit to visual mode. - Press
.
to replay it to the next one.
Update:
This repo showed up in vim-multiple-cursors
’s issues (https://github.com/mg979/vim-visual-multi) and it works good too but I think I do stay on native Vim command so I don’t have to rely on my dotfiles for this feature.
>> Home