← Back to context

Comment by helterskelter

15 hours ago

Up next for 0.13: multiple cursors! I have no idea what I'd do with this feature but it sounds intriguing.

https://neovim.io/roadmap/

Multi cursor support in VSCode replaced 98% of my need for macros. Yes, macros are more powerful, but they are pretty easy to get wrong. With multiple cursors, it's far easier to spot where your inputs don't work out and adjust accordingly.

Multi cursor is the feature that increased my productivity the most across the board.

  • Forget macros and multi-cursor. (Regex) substitutions from vim's command line replaced 98% of my editing needs and rendered a lot of my vim-fu useless.

    (Just like searching with / replaced 98% of my navigation)

    Editing something without having to actually place the cursor anywhere is a killer feature

    Also neovim can show you your substitutions live, no need for a plugin anymore. It's the default.

    • Regex search and replace is definitely among my most used features and the preview in NeoVim is amazing

      That said, I do find myself using recursive macros quite often. They're an easy way to make a set of random little changes which would be hard to put into a solid regex. Especially when filtering and formatting logs to produce a list of error messages on a condensed format for review. It doesn't happen as often, but I also find them incredible when doing more complex substitution across a project.

    • 1) is there a reason both of the other responses to your comment are all full of Bro’s? It this an in-joke?

      2) Regex is great, and vim is a good place to exercise the “try a regex” reflex. And on the regular old bash command line, it is great for making stuff like locate more precise.

    • Word Bro! Regex is so simple to read and easy to get right... and its like if Immanuel Kant wrote find and replace, yeah, learn a new language to do a single function... yEAH! 98% Bro! I'd marry Regex if I could (but if we got divorced it would be my exregex [which is almost a palindrome!] Bro!)

  • Without meaning to sound like the “friendship ended” meme, I was a heavy user of macros in vim and neovim. It was probably my favourite feature. After I switched to Helix, I began using multiple cursors and now those are my favourite feature, I barely use macros anymore. Being able to see your movements live and intelligently using multiple clipboard is not just powerful, it’s fun too and rewards well-designed code.

  • Proper macros are vim and emacs one. They have proper movement shortcut that fits both code and prose.

    Especially as code is formal notation, such that it’s structured quite rigidly, macros composition can be seen as a meta language. Multi cursors is more suited for the “work hard, not smart”, like preferring litteral search instead of learning regex.

Kakoune has replaced many features with multicursor, including the sed-like commands (where you just select an area, search for patterns inside it to create the multiple cursors, then perform regular edits (which also means you can perform much more complex than simple replaces). It is really useful for refactors, e.g. even if you don't have any LSP (e.g. for plain text) you can easily rename symbols, reorder/select in log files, etc

I'm not sure how people typically use neovim, but in Zed I find multiple cursors (especially combined with multiple file buffers) extremely ergonomic for refactoring quickly and easily where tools like find and replace or simple renaming doesn't suffice. It lets you scan through and add cursors where you need them, then perform your edits across locations and even files all at once. It's so nice that it played a significant role in me keeping Zed early on despite it missing a lot of extensions I used in VS Code.

  • I am so used to sed-style, regex powered find/replace, that this use admittedly never occured to me. As a result, multi-cursor seemed mostly useless outside of pair programming that I never do.

    I will have to try it out once it lands in neovim just to see if I can wrap my muscle memory around it.

  • Not sure I under the Zed argument, VSCode has supported milti-cursors since the very beginning. It was made popular (not invented) by Sublime Text because it made it reaaaally easy (middle click+drag), so Atom and VSCode carried the feature.

  • You have very convenient macros. If there is something you want to do in places you are going to mark first then you can just execute it right there instead. If it's just one edit you just do it right there without macro and use the dot to repeat it in more places.

    If those places can be created automatically then again it's just a macro you execute over many lines.

You'd do text editing with it with the coolest feedback loop - immediately seeing the changes and what those changes apply to beforehand, that's different from having to repeat some macro multiple times

  • Highlighted search/replace does this pretty well too.

    • Not really, it only does it for the first edit, while multiple cursors offer continuous feedback for all further besides, search/replace has extra toolbar and usually can't as easily select, for example, "current Identifier under cursor" if those are different, so it's worse before the first edit as well

      3 replies →

Really excited about this! At least in Sublime Text I've found multiple cursors a really powerful tool for ad-hoc transformations on snippets of semi-structured text or instantly and visually applying the same edit on multiple similar lines.

Whats with all the fuss over multicursor. How is this different from just using '.'

Any chance regular vim will some day get multiple cursors? That's the one thing I miss.

Multiple cursors were the killer feature that got me to start using Sublime Text back in ~2010. Still an absolute staple of my text editing toolbox. Ctrl-D Ctrl-D Ctrl-D ...

It's funny because I miss this one all the time. I got use it in Sublime and VScode before making the jump to Neovim. I know you can get similar functionality from macros and what not, but it's just not the same.