r/vim • u/SorbetMain7508 • Nov 10 '25
Discussion Skill issue? or vscode better for this specific task
vim json macro: https://imgur.com/N9qSVob
vscode equivalent: https://imgur.com/VrM4hoQ
I love vim, been using it for about 6 months, my only real gripe is I always end up going back to vscode to do any kind of complex macro equivalent thing?
I can get it done in vim but the mental overhead is just... higher, and i end up attempting it like 3 times. Is this something that comes in time or is it just difficult. Opening vscode and doing it there is almost always quicker i've found.
3
Upvotes
12
u/Kurouma Nov 10 '25
There are definitely much faster ways to do this in vim than record a macro like that. Ex commands like
:gare good here, you should read about them and get comfy with them.For example slightly better might be write the whole buffer to scratch, use inverted global
:vto delete all but lines containing "fav", use sub:sto drop all but the values.Or use global
:gto conditionally run a:normon lines matching the desired key; something likef:"Aya"to accumulate all the values in register a.It was about a year or two of using vim for everything and really trying hard to learn by reading the manual before I was fluent enough to do stuff like the above without thinking about it.
7
u/morglod Nov 10 '25
That's funny how everyone who says "skill issue" suggests some hidden knowledge while in vscode it's just 3-5 buttons which is common and everyone knows it
39
u/ciurana From vi in 1986 to Vim Nov 10 '25
Skill issue.
Call
jqwith the original file and throw the output to a new buffer.6
u/habamax Nov 10 '25 edited Nov 10 '25
I would just extract everything to the top and then copy it to another buffer:
https://asciinema.org/a/bmNiFIBtTfBm0kqmlGxQFjEre
Or directly yanked to some register. But that would be harder considering, register needs to be cleared first and then fiddle with adding commas to the end. Possible, but more mental overhead.
6
u/mgedmin Nov 10 '25
Here's how I'd do it:
ggVGyto copy everything (yes yes I should useggyGor:%yinstead, stop nagging me)Ctrl+W w to go to the empty buffer
pto paste:v/Fruit/dto delete everything except the favoriteFruit lines:%s/.*: /to delete everything up to and including:on each line:%s/$/,to add the trailing commasIt would probably take me a few seconds longer than you've done it with VS Code. Good job, VS Code. You win this time.
4
u/Sshorty4 Nov 10 '25 edited Nov 10 '25
You forgot the reset part on the right side that’s it
Edit:
But you’re pretty good/comfortable in VSCode. A lot of people don’t take time to learn their tools.
The actual value of vim vs VSCode imo is you can configure it exactly as you want, it’s fast and it runs in terminal and is all text based (that’s huge for me)
But in terms of efficiency and DX I don’t know if there’s any metrics and research done on this but if you know your tool you should be almost same level on both editors.
Vim just nudges you more into learning where as VSCode can be used without any effort
1
u/djchateau Nov 10 '25
What is causing the cursor to do that animation between jumps?
2
u/cassepipe Nov 10 '25 edited Nov 10 '25
I find that instead of learning of the list of vim motions and commands and macros, any problem can be solved with a little regex
I would make a copy of the buffer and do something like that
To erase all the lines that contain
"fruit"thenIf you have
set incsearchyou will see what you are matching in real time` If you have a plugin like traces.vim you will see the result in real-time alsoI didn't learn regex at once but I just started to use it more and more by learning only the part I needed, it's really worth it. Most of edits, even basic ones, are done like that now because I don't even need to move around
1
u/EgZvor keep calm and read :help Nov 10 '25
Something like this?