You can make your macros recursive by calling the assigned register during recording. Eg; qw + the things you want + @w +q to stop recording. This way the macro calls itself on completion.
@QckSGaming3 ай бұрын
But when does it stop?
@devlinbowman52513 ай бұрын
@@QckSGaming Usually at EOF. But, experimenting with this, I’ve found it can do some funky things in certain situations. The proper course of action would usually be to make file wide changes via a command, which is both operationally faster and computationally safer, but sometimes you’ve set up a good macro and decide you’d rather get a cup of coffee than repeat the last 30 keystrokes. However, upon further consideration of your question, I should probably look at the documentation to be sure don’t this isn’t an issue.
@ocaly27 күн бұрын
@@devlinbowman5251 wait why would you want this you can "69420@w" to do the same. Recursion sounds dangerous, what if it deletes everything and you want to undo..?
@SayfSentinel11 күн бұрын
There is no need to go down then at the beginning of the line You can just escape then enter it will put you at the beginning of the line
@vikingthedudeКүн бұрын
I like to imagine that vim has all these weird features whose documentation only exists in discussion forums and comment sections
@ghun131Ай бұрын
This is black magic, the dark art I want to learn
@scally9341 Жыл бұрын
holy shit never even looked into what the recording q thing is. legend.
@bashbunniАй бұрын
Guys, of course you can use visual block mode for this, I’m just showing the most basic example of macros in under 60s. Cmon 😂
@maxz999 Жыл бұрын
I had a realization at the end of this clip… I have been calling my macros repeatedly one by one for far too long now. Don’t know why I didn’t notice this earlier.
@paulgupta24547 ай бұрын
sometimes it's nice to just bash '.' repeatedly one after another.
@TheKuhtaMusic5 ай бұрын
yeah, I have been doing @@ repeatedly as well. Thanks for showing this!
@theodorealenas3171 Жыл бұрын
Today Vim macros helped me a lot. :e /tmp/a :.!ls -1 And then I recorded a macro. This /tmp/a file now contained a list of files. The macro would use that list to jump to a file, call another macro, and come back. I wanted to remove the header and footer from all the HTML files of a directory. Then I wanted to do another operation to all the files, so I kept the outer macro and changed the inner. It was an adventure. The context of why I wanted to do it was terrible, but doing it was fun.
@QuantPhilosopher8926 күн бұрын
You can do the same with visual block mode: ctrl + V, then go down to whatever line you want to insert content into, then type an I, then start typing and click ESC once you're done.
@hamm8934 Жыл бұрын
You can also use ctrl + v to highlight the first character of each line and then do shift + i. Type in your bullet points. Hit esc, and then bam you have your check list. I need to play around with macros for sure though
@alacritty Жыл бұрын
Thanks for the tip! Very fast and simple.
@brendencallahan242 Жыл бұрын
ctrl + q if you happen to be on windows (even wsl2) (this only affects the windows terminal not other terminals or guis)
@hamm8934 Жыл бұрын
@@brendencallahan242 maybe you have remapped ctrl + v in your config, ctrl +v works for me both on windows and Unix
@brendencallahan242 Жыл бұрын
@@hamm8934 Nope. It's from the 'new' windows terminal. If you are using a different terminal or a gui it won't affect you. I tried to link a so thread but KZbin deleted the comment.
@hamm8934 Жыл бұрын
@@brendencallahan242 oh interesting, thanks for the info. I use Windows Terminal at work instead of the built in command line of power shell so I must have incidentally avoided the conflict
@ProjectileGrommet6 ай бұрын
Relative line numbering is perfect for this
@bashbunni6 ай бұрын
I will not!!1!
@eamonburns95975 ай бұрын
Yeah, it's great. Although, depending on how you record the macro, you can get "off-by-one errors" if you go by the literal numbers. Just something to be aware of
@anthonydesouza99835 ай бұрын
Macros stop if they can’t go further, so just do 100@q and it will stop after “j” can’t go to the next line.
@eamonburns95975 ай бұрын
@@anthonydesouza9983 that only helps if the section you are trying to change is at the end of the file, which, most of the time, it isn't
@alacritty Жыл бұрын
Love these shorts and learning more and more about vim
@Rh0mbus10 ай бұрын
This is awesome, great example and I can already see how ridiculous the potential is
@wesleychaffin40298 ай бұрын
This was a helpful lil intro to a vim macro! Thanks!
@Redyf Жыл бұрын
I love your videos, thank you for sharing these tips!
@GabeKMusic6 ай бұрын
tip: + moves down a line and moves your cursor to the first char. saves a key press compared to j0
@jacderidaАй бұрын
Wow, nice! Been using nvim/vim since ~2014 and I never came across this before.
@Jag3rm3ist3rАй бұрын
I - [ ] j You don't need to move to the start of the line if you jump there when you switch to insert mode.
@theMRcapitanBANANA Жыл бұрын
This has to be the best thing ever, I didn’t even knew it was posible!
@ascourter Жыл бұрын
Macros have been on my list for awhile. Thanks for the great intro!
@MilanGunasekera7 ай бұрын
Another useful way to do this could be by using a Visual Block . When in this mode, key down to the bottom with G, then press "I" to enter insert mode. You can then insert the - [ ] and exit back to normal mode with ESC
@TheGrouchDnD7 ай бұрын
Saving this for when I inevitably need this
@ilyeshammadi7278 Жыл бұрын
Nice. A much nicer way to avoid adding the j will be to use parallel macros with :3,8norm @w without including the j when recording the macro
@Al-ws7cn5 ай бұрын
After all this time of ignoring whatever this recording feature is I finally learn it, my life is complete. Amazing vid.
@romanferguson40325 ай бұрын
my mind has exploded
@JayJay-rk2xx10 ай бұрын
😮 I'm in awe
@Steliosgiannatos4 ай бұрын
Vim is so powerful, but daunting to start.
@celestialbeing47673 ай бұрын
Mad cool
@juanmacias5922 Жыл бұрын
Macro-mazing!
@maxwebstudio8 ай бұрын
Nice one
@js-ny2ru Жыл бұрын
That was so cool! Thx Bunni :)
@emanuelavilesarchivado11 ай бұрын
i love it! 😎❣️
@zicraftian2 ай бұрын
That is just so cool! I had no idea vim had a feature like this!
@kitti.crafts7 ай бұрын
❤It helped me a lot.
@samdelamarter4557 Жыл бұрын
Great content! Really like this style of short.🐰🧡
@n0kodoko143 Жыл бұрын
In the words of Prime "macro pressure!"
@FakeDumbDummy Жыл бұрын
hell yeah
@buttface6t4 Жыл бұрын
this was super helpful
@user-xd5gd4pc9h Жыл бұрын
Cool!😁
@HomeAlbadawi9 ай бұрын
Thanks this video was helpful
@Yupppi7 ай бұрын
Thanks, I've been learning and constantly hitting recording accidentally and wondering how to use it.
@yuvrajpawar4177 Жыл бұрын
Loved your video with the legend Telescopic TJ♥️. Please try DWM as well you will love it. Absolute respect for your programming abilities ♥️
@c1dk1n4 ай бұрын
Love your work
@lebenebou11 күн бұрын
instead of adding j0 to the end of the macro, you can visually select the lines you want to execute on, and type the command :normal @w it will run the macro on the selected lines
@aquepaique4 ай бұрын
ctrl-v + G + I + *insert mode* - [ ]
@fuzzy-028 ай бұрын
*faith restored* Cute video.
@stuckoverflawsАй бұрын
very helpful! thanks
@vikingthedude Жыл бұрын
As someone who’s been using vim for about 2weeks now I definitely needed to hear about macros
@vikingthedude7 ай бұрын
As someone who’s been using vim for 5months now, I definitely consider macros my bread and butter
@samarthnagar29396 ай бұрын
Ad someone who is using vim for an year it definitely usefull to learn about macros
@jsm33t6 ай бұрын
As someone who will use vim someday this will be helpful
@vikingthedudeКүн бұрын
As someone whose been using vim for a year now, i do think macros are goated
@sidiqalfiansyah932111 ай бұрын
thanks
@j1d7s Жыл бұрын
Thanks for the video! I understand that for the short time available you could not show a more complicated macro. But just as @Hamm said, this example would have been the perfect use case for using block mode. So anyone trying out macros for the first time, still check if another way of doing it is easier / faster!
@connemignonne13 күн бұрын
there's also a much easier way to do this with visual block mode: ctrl + v (to enter visual block mode) press j to go down however many lines you need (or with a number like 5j to jump 5 at a time) Shift + I to enter insert mode type the checkbox stuff and when you hit escape it will be inserted on every line you had selected in the visual block
@lightsite99929 күн бұрын
Blown my mind was
@pluto353110 ай бұрын
ty
@cozyfog4 ай бұрын
You can do the same with ctrl+v for visual block and shift+i to insert
@thecodebear Жыл бұрын
Noice
@marcosduvannitolarodriguez1933Ай бұрын
Thanks
@asadanik59873 ай бұрын
You are JavaScript ❤.. difficult to catch you up. Still loving you silently
@bashbunni3 ай бұрын
That is so mean 😭
@alexfu24222 ай бұрын
Control - v select first character of each line and Shift I to insert - [ ] and hit escape, done. This is more intuitive but more typing.
@olivierlasne2346Ай бұрын
I have been wondering for so long what that "macro recording" was. When I accidentally type 'q' without the ':' to quit vim 😅
@sebaszwarc3 ай бұрын
Other editors was written by developers to help you, in vim you must help yourself
@bashbunni3 ай бұрын
Vim is a lifestyle
@sergp7480 Жыл бұрын
Mix macro with norm and replace - very powerful combo. Nice editing btw 😊
@bashbunni Жыл бұрын
ouuuuuu
@sergp7480 Жыл бұрын
@@bashbunni I also recorded short about macro but with norm
@terry2295Ай бұрын
Using VIM for that is insane to me, like I understand using it for complex scripting but plain text?
@patrickraedler3656 Жыл бұрын
Nice, I didn't know that! Thanks for sharing :) Also, which is that font that you are using? Looks really nice!
@bashbunni Жыл бұрын
Blex Mono nerd font :)
@PofMagicfingers2 ай бұрын
Nice!
@carlossaenz82044 ай бұрын
vim btw
@ashwiniabhishek150422 күн бұрын
When she started to play the recording, my laptop hung because of program I was running and the video started repeating in strange manner, I though what a video effect she has put to show the replay option, but when it became too monotonous and then I realised my laptop is hung ;).
@RolexChan6 ай бұрын
漂亮😻谢谢☺️
@saishinnthant483927 күн бұрын
which font do you use in this video?
@comosaycomosah21 күн бұрын
Anddd I somehow end up with 4 boxes in front of the word instead 💀and the 2nd attempt ended up with the boxes going down this time but off placed by one character into each word instead of in front of the word lmao I need practice
@re1konn10 ай бұрын
An easier way if using macros: Record the action that you want on a certain line. That should not include going to the next line. Now, select all the lines you want that action to be repeated on. Type :norm @ and then press enter.
@nekoill4 ай бұрын
Wouldn't it be easier if you first just hit Ctrl+v and then whatever you need to press to get to the end of your list, then hit capital I, type `- [ ]`, hit Esc and be done?
@bashbunni3 ай бұрын
It’s so funny because originally the video included me saying “this is kind of a bad example because I could just use visual block to add these checkboxes, but I want to keep the example as simple as possible” but it made the short too long iirc, so I just decided not to include it. Now I see so many comments being like “but you could just…” and I’m like ahhh I knew it would come!!
@robertholtzАй бұрын
Two words for you… multiple cursors.
@user-me8dk7ds7fАй бұрын
visual box I think would be easier here.
@heheitskenny3 ай бұрын
Does anyone know what colorscheme is used in the demo here? Thanks
@bashbunni3 ай бұрын
Catppuccin :) the best!
@darklightnessfulАй бұрын
Norm is faster or visual insert
@GrandNecro5 ай бұрын
i would have done ctrl v and I to insert the columns of text
@YourAvgjoe10 ай бұрын
I use space v to bring up a terminal to test my code. I used to be able to click back into my code then edit. Some way I’ve disabled my trackpad, any advice?
@oglothenerd10 ай бұрын
I use Helix. Also, did you know that the creator of Vim died recently!? 😢
@victortesla29357 ай бұрын
😳
@chezchezchezchezАй бұрын
All this work with Xcode VIM mode?
@wl4dymirАй бұрын
You would do this one much faster with a substitute.
@data.monoid878511 ай бұрын
Ctrl+v -> 5j -> S-i -> enter text (- [ ] ) -> Esc
@oErebor2 ай бұрын
What is this font ?
@chonkey2 ай бұрын
Visual block mode would be faster
@user-hw3tu2gx3w7 ай бұрын
Font name?
@HoranMustaplot5 ай бұрын
What is the name of the font she's using here?
@bashbunni5 ай бұрын
I think it’s BlexMono nerd font - it’s been my fave for a while now
@irienas11 ай бұрын
Please what is the name of 𝕥𝕙𝕖 𝕥𝕙𝕖𝕞𝕖?
@shailmurtaza908210 ай бұрын
You already know VIM macros. Why are you here? 😏
@coolguy69verycool4 ай бұрын
I should learn macros, I'd do it with a command like this: ":4,8s/^/- [ ]"
@aryanmn1569 Жыл бұрын
a real question (I'm not anti vim). why shouldn't we use multi-cursor like in vscode? where its more powerful? I mean what this get done that multi-cursors won't or does it slower?
@agfd5659 Жыл бұрын
In this case, visual block mode insert (which is similar to multi cursor) would make more sense, but there are cases where macros become very useful.
@bashbunni Жыл бұрын
I kept this as a suuuper basic example that can definitely be done in many ways. Macros are overkill here, but for simplicity I decided to use it as an example anyway
@aryanmn1569 Жыл бұрын
@@bashbunni it would be nice to see an example which cant be done without multi-cursor, to really feel the power.
@agfd5659 Жыл бұрын
@@aryanmn1569 So one example would be: imagine you have a comma separated values file like this: some,thing,hello world,more,stuff yet,another,line containing,imortant,values And you need to capitalize the first letter of all values in the second column like this: some,Thing,hello world,More,stuff yet,Another,line containing,Imortant,values This would be difficult (or maybe even impossible) with multi-cursor. With macros, this is easy: 1) Go to the beginning of the first line. 2) Record the macro into the s register with qsf,lvUq 3) Now apply this macro to every line in the file with :%norm@s And you're done!
@ChrisCox-wv7oo8 ай бұрын
@@aryanmn1569 multicursor is really powerful, no doubt about it. the other day I had to refactor some code. we had several dozen functions that had static local variables and I wanted to pull them all out and make them class members. the variable could be defined anywhere within the function. first line, last line, middle. sometimes there were multiple statics within a single function. I ended up with the macro /static^Mdd^^p^O@q search for static keyword (/static), delete that line(dd), switch to last file which was the header (^^). paste correcting indentation ([p). return to where static was deleted from in cpp (^O). run macro again (@q). it neatly moved all the statics from test.cpp to the last cursor location in test.h. is something like this possible with multicursor?
@Dimarichek Жыл бұрын
What font do you use?
@bashbunni Жыл бұрын
BlexMono nerd font
@Babbili6 ай бұрын
Is there documentations for Vim, i can learn it from
@bashbunni6 ай бұрын
Try :Tutor when you’re in vim/neovim. That one is a full walk through. Also :help has a lot of great docs. There are lots of great docs online for neovim as well. Will make note of this though, might be worth listing off some of the different text-based resources for learning vim and lua
@Babbili6 ай бұрын
@@bashbunni thanks
@Heart0rHead Жыл бұрын
Any modern IDE with multiple caret support will do this faster and easier.
@chillmelon78949 ай бұрын
Why not just use block?
@axewellll8 ай бұрын
bad example, you don't need macros in this case
@ErdajtSopjani2 ай бұрын
wifey
@rhymeflakes8 ай бұрын
Is this default feature?
@bhavyakukkar7 ай бұрын
yes
@pranaydeshmukh820711 ай бұрын
What is Vim macros
@421sap4 ай бұрын
God bless you in Jesus' Name Amen ✝️
@Tanmaydeshpande-nl5jy21 күн бұрын
no way you qw and not qq
@grim.reaper Жыл бұрын
I love this 🥹
@Luanxxxxx6 ай бұрын
I don't care that you're pretty, I only followed because of the vim macro I love
@dogaarmangil6 ай бұрын
Big omissions: You didn't say which mode are you starting in, and you aren't showing the status line that indicates the current mode.
@jiangyz2 ай бұрын
Such a cute girl to demonstrate vim! I came out 4 ways to do kind like this by using macro (from the comments and my experience): (Substitute "- [ ] " with "- " to simplify the demo , using q as the macro register.) 1. Repeat Apply qqi-q j@q j@@ 2. Batch Apply qqi-q u vap @q 3. Recursive Apply qqi-j@qq uu @q 4. Range Apply qqi-q u :1,$normal@q
@RuslanKovtun Жыл бұрын
Very very very bad example because Ctrl+V followed by "I- [ ] " will do the same and way easier for this example. Macros are for more complicated things.
@bashbunni Жыл бұрын
Ah yeah I did have a disclaimer about it not being the best example at the beginning of the video originally, but in the interest of keeping the example as simple as possible, I decided to just leave it despite being able to accomplish the same thing with visual block. I don't think that makes it a bad example, just the simplest possible example for how macros work :)