One feature useful to me is Ctr-V column visual mode. This way I can avoid typing lines nearly the same multiple times. Is there a way in vim I can do this over a range like 5,14,22,.. so that the change is applied to those lines as well?

  • You could use a macro, or the :t Ex-command, or C-x C-l line completion. But i dont think you can get split multiple cursors. A :g command might do it if the insert region is delimited by a pattern. – D. Ben Knoble Dec 15 '17 at 5:21
  • 1
    Your question makes me me think of Multiple cursors at desired location where I wrote an answer which could interest you. – statox Dec 15 '17 at 10:17

Not without a plugin.

There are a handful of plugins with "multi-cursor", "multi-line" and/or "multi-edit" functionality.

At least one emulates the multi-cursor behavior found in the Sublime editor: https://github.com/terryma/vim-multiple-cursors. The basic functionality is to place cursors wherever you like by clicking and then start typing. The text will appear simultaneously at every location with a cursor. You can also place the cursors based on a regex rather than where you click your mouse. I've installed this one and it works pretty well but I don't use it all that much since it's not a way of working that I find myself unable to replicate or approximate by other means.

Another operates a lot like Visual mode except you can select non-contiguous sections of text: https://github.com/alfredodeza/plexer.vim . I haven't tried this one.

I'm sure there are others.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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