Amazing Vim Macro
Ғылым және технология
Recorded live on twitch, GET IN
/ theprimeagen
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact
Kinesis Advantage 360: bit.ly/Prime-Kinesis
Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
turso.tech/deeznuts
Пікірлер: 193
The fuck is going on
@ThePrimeTimeagen
7 ай бұрын
blood magic, just not the shitty witcher tv kind
@sakib123321
7 ай бұрын
If ur being serious, I believe he made a reusable macro that searches for like the header of a section and makes it into a link at the top for a table of contents.
@paultapping9510
7 ай бұрын
living that hashtag vimLife.
@sakib123321
7 ай бұрын
@@jacobthomas1344 Happy to help :) vim also looked very strange to me until I had a course unit dedicated to it.
@steamer2k319
6 ай бұрын
Vim
Spellcasting in vim
This is exactly what I feel a senior engineer does thanks prime
@SoHawful
7 ай бұрын
Senior engineer is just a title and there is a lot of variance in skill (source: I also have that title and I can't do this 😭)
@cruxae
7 ай бұрын
Senior engineers don't waste their time with this. Instead they spend their time on bringing business value.
@Mordewolt
7 ай бұрын
@@cruxae this kind of meaningless gibberish is exactly the kind of thing i expect to hear from a guy that tells everyone that he's a senior engineer
@jewhunterbiden
7 ай бұрын
@@Mordewolt the pretentiousness is hilarious
@csaratakij6339
7 ай бұрын
@@cruxaeskills issues
I can't wait to have a software job and be a wizard, too.
@ThePrimeTimeagen
7 ай бұрын
time and practice
@connorskudlarek8598
7 ай бұрын
@ThePrimeTimeagen oh it'll happen. I'm sufficiently motivated. My github has never been so green, thanks in part to you.
@mehdiyahiacherif2326
7 ай бұрын
@@connorskudlarek8598 no one will notice what you do, but it is still satisfying!!
@vaibhavnayak909
7 ай бұрын
@@connorskudlarek8598ikr.
@svenmify
6 ай бұрын
Don’t need a job for that. Become good on your own.
TLDR: The macro finds markdown headings and formats/copies them into TOC format.
@wh7988
6 ай бұрын
why tf are u giving a summary to 30 second clip
@DeltaNachos
6 ай бұрын
@@wh7988 a lot of other comments were confused people
He’s beginning to believe
Holy fuck... whenever i see Mr. Prime do his magic I am reminded that I've still only scratched the surface of vim motions
I might need to learn Vim
@ThePrimeTimeagen
7 ай бұрын
the macros are sooooo good
@vikingthedude
7 ай бұрын
I did it last May and it’s been worth the investment
@cesarromerop
6 ай бұрын
I do this in emacs regularly. /me docks and covers
The two time is clearly very talented
*Me barely knowing how to print Hello World in python.* Yeah, of course, who would do it any other way?
Must say, kept up with the keys and understood it all, such a pleasure to be at this point, trying to utilize macros as much as possible.
@rewrose2838
6 ай бұрын
Where do you start with this, whatever this is? Does vim have some official docs I could refer?
'replay' is my safe word too 😏
I love vim macros so much that I don't even use an OS anymore, I just write vim macros directly to memory and cpu. Seriously though, a non-techy friend of mine once had a summer student job which required repeatedly editing text files for some archiving project. So I recorded a vim macro which did his entire work automatically in seconds, saving him the summer. Go vim
The trick with macro replaying with marker is so good, never thought of it.
I’m not even a software dev (cyber) and I watch you religiously. Seeing what in-depth knowledge you have in your profession is mesmerizing. Thank you for existing brother
That was smooth, like coconut oil.
@nobleradical2158
7 ай бұрын
I slipped and fell down on the coconut oil
I started using Vim all because i watched your damn video. Now i can't escape 😭
@HansMartinSchleier
7 ай бұрын
:q! 😉
@realhumanbean7915
6 ай бұрын
Why does everyone who seems to get into vim develop a Stockholm syndrome
These videos feel so good. Almost enough to switch me from Helix back to Nvim
Appreciate the grind!
I can now put expert markdown developer on my resume
the fuck is that speed, are u feeling well? crazy nice the marks fang shui
I need to figure out markers cause I can’t understand how just replaying the macro goes to the next heading
@marinus86
6 ай бұрын
With a default config you create a mark with the prefix m and then the key you want to assign the mark to (Prime uses i at the table of contents and o at the last heading he found). You navigate to a marker by hitting ` and then the key assigned to it. The macro includes moving the o marker so each time it is repeated it searches further through the buffer.
That's pretty darn good. Would prefer to just use multiple cursors though.
Bro channeled his American past life😂😂
Peak software engineering right there /s
I needed to watch this like four times to understand what he's using the macro to scrape the headings into a table of contents
Man, I feel installing VIM equals a bachelors degree and learning it a masters degree
How in the KZread algorithm did I end up here…..is this where life ceases to exist?
You’re right, greatest vim macro I’ve ever seen. Only one too, so there’s that.
How you replaced spaces with dashes? some regex replacement that was saved in command history?
@sharon2250
7 ай бұрын
Wondering the same thing…
@alsmnn
6 ай бұрын
Mark the whole line with V then hit ":" to enter a command and enter the following: s/\%V /-/g So he played at least with the regex before recording.
marksman code action - > create table of contents
This is the first vim macro I've seen so you're right.
As a newb, I'm missing how the marker keeps travelling down instead of always doing the first entry. Can someone explain? Edit: Ok I got it. I kept missing the navigation to O before the search.
Ive been *actually* using vim for about 6 months now and Im only starting to use macros. Now this is gold but even for like small things, say like removing special characters from the line or incrementing lines numbets is very simple.
@ThePrimeTimeagen
7 ай бұрын
if you are new... wait until you try g on a visually selected set of numbers 0, 0, 0, 0, 0, -> 1, 2, 3, 4, 5,
@xhivo97
7 ай бұрын
@@ThePrimeTimeagen repeat for 2, 4, 6, 8, 10,
I have no idea what happened but looks fun and satisfying 😮
Best ending ever recorded on camera
He cant keep getting away with it!
Nice gonna try it later
Jesus fkn christ! I need to learn vim, you convinced me. Teach me Master!
That does feel good, I'm trying to make a Lua script for flutter in neovim to create clean architecture files and folders in flutter with bloc and cubit, hope one day I'll be a real wizard with time and practice
Can always appreciate a good macro
OK, only question is why the star, when each line has the - in it? Having the anchor start with - seems an odd choice
I have no idea what the frick just happened
Feral vim guy
Fucking genius, god of vim himself
Oh that's hot.
woah, woah, woah, hey, hey, hey
That's a vim god level macro
Is the search command able to find next ## based on the last time we use it?
@renefernandez360
7 ай бұрын
I think that is because of the jump back he keeps jumping to the first and the last that he was at then he search the next one
@what1heh3ck
7 ай бұрын
@@renefernandez360thanks, I just notice he used “mo” again to mark the line with ##. Not sure if you could seach for the next ## after jump back to that marker (cursor place at the last ##) but I will try it later 😮
I watched this four times
That could be a really good rap. In my mind am going boob-chick-chick-boob
Yo, replay replay replay replay
Hey, this isn't done automagically? :OO
Bro does everything except programming 😭
That’s cool
I'll have to learn markers now
I'm pretty sure i know what happened and it's still some dark magic
Table of Contenta blazying fast!!!!! Only available in vim
How does hé change with dashes?
Wait, doesn't the link have to be all lowercase?
I just typed the first line and let copilot do the rest
long term vimmer and can confirm greatest macro ever
@wl4dymir
6 ай бұрын
long term vimmer and can confirm I understood absolutely nothing
Is that Tom?
@connorskudlarek8598
7 ай бұрын
Nah, Tom's a genius. This guy just worked very hard. Tom can invent JDSL. Prime would never ever do that.
Smooth but this is something copilot would do for me faster
Nice
It’s kind of uncanny how much you sound like Jay3 from overwatch
Fucking beautiful
Oh wow that's what a 180 IQ points must feel like everyday huh?
Do you use vim at work?
Amazing! Love you big moustache man
What in the hell just happened? Am I still on planet earth??
@steamer2k319
6 ай бұрын
Vim macros. Vim has two modes: command mode and edit mode. In edit mode whatever you type just goes into the text document. When you switch to command mode, though, every letter on the keyboard becomes a one-button command for e.g., seeking to new cursor positions, cutting, pasting, find/replace, etc. You can chain a series of commands into a 'macro' and replay it in different times/places. If the macro is abstract enough, it'll work in different contexts. Here, Prime builds a macro to find header lines (that start with '##') in the document. The macro copy/pastes them to a marked area of the document where he wants to build a table of contents. In addition to pasting the title text, the macro also creates a second duplicate and reformats it as an href/anchor so that readers can click the link when loading the document in a browser. Prime verbally calls out the descriptive name for each command he adds to the chain. The one- letter/key binding for each command is also shown as a screen overlay for the video. It's very impressive that he was able to chain together the right sequence in one pass with no mistakes in his logic and no fat-fingering the wrong key 😅. It's apparent he's gotten a lot of practice with Vim.
I vim, but this... Holy shit.
What magic is this
"This is the greatest vi" skip
im gonna stick to nano
help my neovim sucks, can someone recommend something that could replace vscode?
lol org-mode just has table of content autogen
I love you you are great
Finally, someone who can vim
For those of you who don't understand, I'm a junior CS Major so let me explain... I have no clue either.
@orbatos
7 ай бұрын
Even if it isn't trivial it's straightforward, pull up a document written in Markdown and follow along.
More vim content
Vim users use macros like they are magic spells, Emacs users use macros like paper towels. 😂
Damn
@ThePrimeTimeagen
7 ай бұрын
its a gooden
i use vs code in my arch btw 😂 (jk i use nvchad)
Does it matter if i learn vim if i am a beginner in programming.
@bhavyakukkar
7 ай бұрын
awk, vimscript & lua are the only languages you'll be using on (not in) vim/neovim, and you can go pretty far without having to. prime also has a nice video where he configures neovim live
@ragectl
7 ай бұрын
You can, then you have two programming languages to learn 😂
Emacs Lisp TOC macro DSL for these type of macros.
The time I would waste thinking how to do it, it would be more efficient jost do it manually
Sorry bro. My brain uses neurons to operate not transistors. Let you know when I upgrade.
I think i'll stick to Obsidian
@secretzpt176
Ай бұрын
Why would you edit your repo's readme using obsidian...
I just came
I have been using with Vim for 4 years now but seeing someone using and saying it out loud like this made me progasm
@dongct2504
7 ай бұрын
fr 🤣🤣🤣
I know this is going to hurt Prime's soul but... in vscode, all you have to do is (# and and VSCode will figure it out and provide auto fill. Thus, making the process even shorter ;) Well, if you have 40 headings, vim motions will certainly be faster. VSCode, the harry potter of blood magicks. The greatest back handed compliment ever lol
@sacredgeometry
6 ай бұрын
Let the caveman get excited about his wooden stick.
VIM wizard can't deny it.
That's nice, but can it Microsoft?
1) what
wtf what that
VSCode Supremacy starts because of things like this.
Its double @ to replay a macro.
Oh Yeah? I could’ve easily done that 5x slower
....what?