N.B.: Vim uses the term "cursor" for the insertion point in the editor, whereas Windows traditionally reserves the word "cursor" for the mouse and uses "caret" for the insertion point. However, if you do want to use them, your editor has to support them. Even if your editor supports them, you don't have to use them if you don't want to. Whether you think Vim should or should not support multiple cursors, it must be conceded that multiple cursors are wildly popular and quickly becoming a "de rigueur" feature for a modern editor. For those cases, a macro is the preferred and tried-and-true method. This rationale does not apply to general-purpose non-temporary macros. But, if you could see the "macro" playing out in real-time in the other places that you intend to apply the macro, you could bypass this two step process. And the longer the macro, the more work that is involved and the more likely there is to be a mistake. Any time that the best way to accomplish a text transformation in several places would be to record and use a temporary macro, that same task could be probably be performed more easily and intuitively with multiple cursorsĪs any one who has ever used Vim macros can tell you, it can be hard to execute the key sequence perfectly during recording, often resulting in several failed attempts before the perfect version that is repeatable so that it achieves the desired effect.However, upon reflection, there is one powerful argument for multiple cursors in Vim: Some people argue that multiple cursors are unnecessary in Vim because Vim provides a variety of powerful ways to rapidly act on isolated sections of text, most notably but not limited to the repeat command. Likewise, in insert mode, if you have multiple cursors, the user intuitively expects what is typed to be inserted at each of the cursors. Any casual Vim user could guess that if you can see multiple cursors and type in a normal mode command, the same command should apply at each of the cursors. The interesting thing about multiple cursors is that, except for the process of creating them, using them is very intuitive. In native selection mode, this allows you to type over a new name for multiple separate identifiers at the same time.Īlthough Vim 8.0 does not have built-in support for multiple cursors, there are many plugins that provide varying versions of this capability, most notably: command which adds a new selection at the next occurrence of the current word. Visual Studio itself has some limited support for using multiple carets to edit files, specifically the Shift+ Alt+. Later versions of Visual Studio 2017 and all versions of Visual Studio 2019 support multiple carets and multiple disjoint selections. Visual Studio Code also provides multiple cursors very much in the style of Sublime: The popularity of multiple cursors appears to have started with (or perhaps gained traction in) the Sublime editor:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |