0

A feature that I love in VSCode is to be able to use my mouse to click at multiple points in the screen and type with multiple cursors.

I am aware that in Vim you can do the same in visual mode, but I've found that it can only be done when the column numbers align and the rows are one after another. What I'm asking is for something similar to t mode in vifm.

What if I wanted to 'select' word 3 in line 1 and word 7 in line 4? I would like to type the same thing after word 3 in line 1 and after word 7 in line 4. Currently I type it in line 1 first, yank, and paste it in line 4 (after word 7). Really, the only need of this features is to be able to type the same message at different points in the file.

Is there a way of placing my cursor after these words individually rather than visually selecting everything in between the two (or recording a macro). I don't want to install the multicursor plugin and wondering if this can be done natively (potentially in select mode). Thanks in advance.

  • 2
    Welcome to Vi and Vim! What do you want to do with those words? That’s often more important and reveals powerful vim ways to accomplish your goal. (There are multicursor plugins, but vim doesn’t have exactly what you describe, so editing to tell us your goal will help us identify the right strategies for you to try.) – D. Ben Knoble Jun 1 at 11:11
  • @D.BenKnoble Thanks for the comment. I added exactly what I am trying to do. Let me know if further information is needed. – justahuman Jun 1 at 17:27
  • 1
    Welcome to Vi and Vim! You might want to take a look at this answer, which covers a similar topic. There are some plug-ins in Vim that implement multiple cursors, but they're typically somewhat limited in what they can do... The "Vim way" is usually using different primitives to do the job, but it typically depend on what the two words you want to replace are. (Matching tags such as in HTML or XML? Repetitions of the same word, such as a variable name? Etc.) So maybe edit your question to make it even more specific about which words to replace? – filbranden Jun 1 at 21:42
  • 1
    depending on your use case, you could use ., which repeats the last thing you did (usually). :help . – Zoe Jun 6 at 14:17
0

Unfortunately, I found that this is not possible in the manner of VSCode (natively). However, you can use the multicursor plugin, macros, and */# to perform similar The comments to the question contain helpful links to old posts which are trying to achieve similar goals, some of which are possible.

| 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.