Hacker News new | ask | show | jobs
by w4rh4wk5 88 days ago
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.

3 comments

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.

Bro, not every guy/girl is a regex master, multi-cursor is a much better UI/UX wysiwyg editor for everyday users.
Terminal editors are not WSIWYG applications. I don't think multi-cursor is the correct for a vim motion workflow but I'll admit my vim-fu is not as strong but I get by with the substitute command + grep good enough where I rarely feel the need for a GUI editor to use multi-cursor.

Since VS Code is already an inefficient way to move around a code base, I don't think we should take any lessons seriously outside of how useful the LSP protocol become for adoption.

I think multi-cursors can be seen as an extension of macros, just that instead of defining the macro and navigating to the relevant places you instead navigate first and then execute the commands interactively (in essence skipping the part where you have to record). As a side effect you also don't need to be that concerned about what to do after having made a mistake. I've had some pretty nasty string-wrangling with the substitute command that could've been avoided by just using a macro and the other way around. I'd argue these things complement each other and there is no need to restrict yourself arbitrarily. Having it and not using it is better than needing and not having. I can recall countless times where multi-cursor would've been just the sweet-spot I needed.

P.S.: multi-cursor is not about moving around the code base and therefore not taking lessons about navigation has no impact in this matter.

Sis, substitutions started being useful being I even learned Regex and I have done an incredible amount of edits with the just the bare minimum of Regex knowledge
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.