Hacker News new | ask | show | jobs
by zahlman 20 days ago
> I’ve had people tell me how “fun” it was to build a macro to handle some one-off text-refactoring problem.

I can't relate, either as a Vim user myself or having heard other users.

To the extent that it happens, it's surely because the macro can be seen as a sort of programming. Vim offers you two esoteric programming languages, if you want to see them that way: vimscript obviously, and the simple concatenation of Vim commands. But any system consisting of a text editor plus a way to record and play back its commands gives you the latter. Vim isn't doing anything special to create that second esolang; it's just bundling the playback mechanism.

But that rather is the point: creating the macro is as much "scripting" as actually using vimscript is. Not only is it recorded in an at-register, but it can be stored as plain text in a vimrc file. It should be compared to "written a quick script" and not to "used multiple cursors"; and any sensible Vim user would have a different approach (commonly powered by :%s/foo/bar/g , perhaps with backreferences) to the cases where Sublime's multiple cursors shine. (Yes, you can use visual-block across multiple lines if everything lines up; and yes, it's inferior to a real multiple-cursor system; and no, I don't think I've ever personally had a use case for it.)

There are people who reach a level of proficiency where they enjoy the challenge of an intentionally difficult to use programming language. Vim macros are accidentally a programming language, and definitely not intentionally difficult. And using them to "handle some one-off text-refactoring problem" is entirely missing the point, and a sign that one has more room to grow in proficiency and a lot more room in wisdom.

In short, the people you've heard this from should not at all be taken as representative of Vim users.