Vim as your editor - Advanced Motions P2

Поділитися
Вставка
  • Опубліковано 26 вер 2024

КОМЕНТАРІ • 439

  • @ThePrimeagen
    @ThePrimeagen  2 роки тому +220

    Chief Edging Officer here. Real talk. Thank you so much for all the amazing support. I cannot thank you all enough. TRULY.
    You know everything I do is live on twitch? Where you can see me scream at you... BLAZINGLY FAST.

    • @noomondai
      @noomondai Рік тому

      Thank you!

    • @nick_esqueda
      @nick_esqueda Рік тому +1

      sus 🧐

    • @AG-ur1lj
      @AG-ur1lj 29 днів тому

      I remember following this series as it was released. Most of these are 2nd nature to me now, but I came back to this one to check for tricks I might’ve missed.
      On rewatch, 7:32 has me a little confused? Why VY and not just Y?

  • @powerslave12r
    @powerslave12r 2 роки тому +137

    Love this series. Please keep em coming! Blazingly Fast. Love the laterally inverted plaque lol.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +15

      WE ARE TRYING

    • @powerslave12r
      @powerslave12r 2 роки тому +4

      @@ThePrimeagen I shall send some coconut oil if it helps.

  • @amlanjyotilahkar1451
    @amlanjyotilahkar1451 2 роки тому +51

    the only person whose videos single handedly inspired me to dive deep into vim, learn some of the unusual stuff and gradually get good with it, congratulations to you prime for the 100K and also for these BLAZINGLY FAST contributions to the vim neighborhood. Keep the coconut oily movements coming!

  • @gideon1884
    @gideon1884 2 роки тому +65

    Love the o tip for moving the cursor in visual mode.
    Another nice one to have is gv to reselect previous visual area

    • @kleanse
      @kleanse 2 роки тому +8

      I was going to mention the “gv” Normal-mode command too. It’s very convenient after you made a mistake with Visual mode, such as selecting one line too few or too many as ThePrimagen did at 9:00.

  • @brick4667
    @brick4667 2 роки тому +25

    So glad you're doing this series. Your video on 'g' was the first of yours I watched and was blown away how f***ing entertaining you were. Not sure this would be vim-specific but it'd fit nicely in this series... a Regex series for things like the fighting kirby and any other oddities that go beyond the basic blob operator

    • @loeschg
      @loeschg 2 роки тому +1

      have a link handy?

  • @calder-ty
    @calder-ty 2 роки тому +2

    What I love about your vids is that they aren't pretentious "10 vim commands you don't know", but show so many cool tricks I've not used before. Almost every other video out there is the same 10 commands, probably all sourcing the same medium article on "obscure" vim commands.

  • @chamber3593
    @chamber3593 2 роки тому +130

    Thnx CEO of multi billion dollar startup.

  • @nodidog
    @nodidog 2 роки тому +27

    You can gp instead of just p to move the cursor to the end of the paste (rather than having to manually navigate). Works with P too, using gP

  • @dannelalbert7111
    @dannelalbert7111 2 роки тому +8

    I've learned more new things about vim in the last 10 minutes than I have in months. You're a beast primagen lol. Please keep this series going!

  • @alfredoortega4933
    @alfredoortega4933 2 роки тому +5

    You ALWAYS have something new to show about vim, I am very impressed... every time I see you, I have got something amazing and blazingly to learn!

  • @ThePhiliposophy
    @ThePhiliposophy 2 роки тому +2

    You are the only UA-camr where I need to turn the playback speed down to 0.75x. I watch most tutorials at 1.5x. Blazingly fast was an understatement, dude. Anti-clickbait, that's what it is. Next time I expect a more honest title such as: "Absurdly hypersonic, scratch that, faster than light-speed Vim" I loved every second (which in my case was 25% longer) of this tutorial. Been using Vim for about 1.5 years and some of the tips in this video still managed to blow my mind! Thanks Prime, solid as ever!

  • @sergmont
    @sergmont 9 місяців тому +1

    I cant believe people actually work like this, this is incredible. I'm taking the leap of faith into believing this is worth ti

  • @YannMetalhead
    @YannMetalhead 2 роки тому +4

    It's like watching a Sorcerer revealing his secret spells.
    Thank you very much, that's awesome!

  • @jamesgourley2239
    @jamesgourley2239 2 роки тому +2

    This series is what I have always dreamed of. Thank you for doing this. The fighting one eyed Kirby is a game changer

  • @albertgao7256
    @albertgao7256 2 роки тому +2

    the rule of watching ThePrimeagen video, you like first, then pressing the play button

  • @evadeflow
    @evadeflow 2 роки тому +3

    Felt compelled to comment again after watching all the way through. Please make more of these videos! 🙏 This one was hella useful. I already have the muscle memory for the individual steps you showed in this vid, but just hadn't quite figured out how to string them together to assassinate the repetitive little manipulations we do all the time (like your example of setting the elements of that `data` array).

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +2

      It feels so awesome when you get to it all together

  • @tandlose
    @tandlose 2 роки тому +6

    @ThePrimeagen best thing i did to my config was making w => e while in operating and visual mode. If you think about it, you almost always want to use w (include space) while navigating, but use e (exclude space) while performing an operation. So this mapping just combines the two with almost no drawbacks

  • @ernesto906
    @ernesto906 2 роки тому +1

    I finally started to using vim because of this series, this video is the first one that I have to "study" because IMO is the high level stuff, Keep the good work!!!

  • @YashGupta-dr5re
    @YashGupta-dr5re 2 роки тому +19

    8:40 Prime, I am really interesting in seeing a video about the vim sed commands!
    I have recently started using find and replace a lot in vim, especially where I used to do macros.

  • @thecastiel69
    @thecastiel69 2 роки тому +1

    seat-belt sign is the beautiful motion

  • @joshuaward4725
    @joshuaward4725 2 роки тому +2

    This series is awesome. Learning new vim tricks every episode!

  • @itshassanaziz
    @itshassanaziz Рік тому +1

    Best vim course by far, you really dove right into it. Also everything is so fast haha, need to rewind 10 times to see what you just pressed, but it's amazing seeing firsthand just how fast a true Vim user can code. I'll keep practicing and hopefully will reach that level as well soon.

  • @ustongs
    @ustongs Рік тому +1

    I just found you and I feel soooo goo bc I already knew every single trick showed heere, I feel so proud of me 💌you are such an inspiration, keep goiing!!

  • @denzilv
    @denzilv 2 роки тому +5

    Another banger! This one I'll have to rewatch a few times to get it because my vimming isn't quite at this level yet. I guess that's why I'm only Principal Janitor of TheStartup. 😅

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому +4

      Well... technically you are director of janitorial engineering...

    • @denzilv
      @denzilv 2 роки тому +3

      @@ThePrimeagen I stand corrected, Mr. CEO. I will update my business cards and email signature appropriately. 👍

  • @iMagicGraalOnline
    @iMagicGraalOnline Рік тому

    Me listening to Prime talking about VIM:
    "I like your funny words magic man"

  • @nikensss
    @nikensss 2 роки тому +1

    Damn, I like the g thing. Also, to go to the beginning or end of a function I usually go with [{ or ]}.

  • @davidkuda7074
    @davidkuda7074 2 роки тому +1

    "glad I watched until the end."

  • @Dongdot123
    @Dongdot123 9 місяців тому

    I can't believe I'm touching and even learning vim again after I hated it for a decade, just because of this channel

  • @tearsinrain2049
    @tearsinrain2049 2 роки тому +1

    just don't stop teaching, you're the best!

  • @yashashwinkarthikeyan1701
    @yashashwinkarthikeyan1701 2 роки тому +2

    loving these motions which go into a pair of parens / quotes and do stuff inside them.

  • @kevinwood5048
    @kevinwood5048 Рік тому

    I’m on team built-in vim motions for the exact stated reason that they will likely work in whatever vim ide plugin you’re already using. Excellent advice!

  • @lucastperez
    @lucastperez 2 роки тому +1

    I have always used the vertical select mode to g+control+a, loved to learn that just selecting it with line visual is enough, so much easier! And the "o" to go back and forth in visual mode, also didn't know that! I guess it can be used with the extra tip and the end, if you are in the middle of a humongous json thing, you can do a vi[ and then "o" to go to the top as well.

  • @pavel_espinal
    @pavel_espinal 2 роки тому

    The "vi{" gold nugget at the end also works when editing massive HTML/XML/etc. documents on which you have no idea where a tag begin/ends. You can use 'vit' or 'vat' (select inside tag, or select around tag -or whatever the 'a' means), and it's a good way to jump between opening/closing tags. Pressing 'o' (like in "oily, coconut-oily") helps moving to the start/end of the selection.
    As always, great video, Primeagen. I felt walking through the Valley of Shadow of Death every time I had to edit an array.

    • @andyw732
      @andyw732 2 роки тому +1

      Even better gold nugget: ]} or [{

    • @pavel_espinal
      @pavel_espinal 2 роки тому

      @@andyw732 Ty. I need to try that. I believe I saw that somewhere before, but didn't work for me 🤔

  • @rickhackro
    @rickhackro 2 роки тому +1

    Keep them coming!
    There is also " :.,.+{numer} norm " to apply a sequence of comands in normal mode from current line + {number}. For exemple, insert a semi-colon at the end of 3 lines: ":.,.+2 norm A; "

    • @rickhackro
      @rickhackro 2 роки тому

      You can pre enter ..,..+{number} by pressing, in normal mode, {number} followed by :

  • @Wandering_Horse
    @Wandering_Horse 2 роки тому +1

    Damn your vim skills are in god mode!
    Going to take away the % sign tip and work it. Thanks for all your vids, I still go back to the original 1-6 series to refresh skills 👍🏼

  • @Mawkler
    @Mawkler 2 роки тому +2

    5:20
    Instead of doing va}Vd you can also do dVa}
    dV is line-wise delete. The advantage to doing dV instead of V...d is that you can repeat it in any pair of curly braces. Repeating V...d just uses the static visual selection, i.e. the same number of lines all the time.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому

      much smart!
      i didn't realize you could chain it like that!

  • @sabirbarahi8299
    @sabirbarahi8299 2 роки тому

    Vim god hath once again bestowed upon us new knowledge

  • @n0kodoko143
    @n0kodoko143 2 роки тому +1

    that background makes gruvbox that much more #hawt prime...glad I stayed until the end!

  • @zugrath16
    @zugrath16 Рік тому

    I recently discovered a (pretty stupid) trick: map and to "4j" and "4k". Then whenever you're holding J and K to scroll, just hold the ctrl key as well and you will scroll 4x faster.. Great for when you want to quickly move the cursor like 20-30 lines and don't want to think about it.

  • @tejeshreddy6252
    @tejeshreddy6252 2 роки тому +1

    Holy shit. This is one of most informative videos that are very entertaining on this entire site

  • @TheBusttheboss
    @TheBusttheboss 8 місяців тому

    This series really convinced me to start using Vim motions. Now I have Evil in my Emacs :)

  • @VolodymyrMasliy
    @VolodymyrMasliy Рік тому +3

    Great video! I was surprised that you could do ci", di", etc just when you are on the line. For some reason I thought I need to literally be INSIDE the "
    That's a deal breaker :)

    • @ThePrimeagen
      @ThePrimeagen  Рік тому +1

      yes, this is the mind blowing speeds of vim :)

  • @kylenelson5552
    @kylenelson5552 Рік тому

    I am SO glad I stayed for the end of this video

  • @andyw732
    @andyw732 2 роки тому

    Suggestion for Your bonus tip At the end of the video: vi{ can be replaced by ]}, which will bring you to the end of a “scope”. I think you can repeat by using ; which will navigate to the end of the next (inner) scope

  • @avimehenwal
    @avimehenwal 2 роки тому +1

    I love your videos .... Now I have switched 50% of my workflows to nvim and can use it to get things done. Thanks to your video it's not that scary anymore :D

  • @frederickmichaud6783
    @frederickmichaud6783 2 роки тому

    Glad I watched till the end, but happier that caught a glimpse of the elusive plowghini.

  • @mindkindtv8038
    @mindkindtv8038 Рік тому +1

    Man I'am from Russia. Thanks. My speed In Vim going to the sky. U're godlike

  • @nodidog
    @nodidog 2 роки тому

    If you don't already know - 'verymagic' mode makes writing regular expressions easier (all keys have their special meaning by default besides alphanumerics and _), and it's negative 'verynomagic' is equally great for verbatim text

  • @mischavandenburg
    @mischavandenburg Рік тому +1

    I love how you sprinkle :w everywhere

  • @rodelias9378
    @rodelias9378 2 роки тому +1

    Thanks! This series is pure gold. Keep it up, please!!

  • @jaopredoramires
    @jaopredoramires 2 роки тому

    I didn't even KNOW about p for paragraph and a in visual mode for "around". Nice to keep on learning movement! Finally in my "advanced" phase, I miss seeing new content, like this!

  • @7h3mon
    @7h3mon Рік тому

    Thank you for all videos about Vim Movements! I walked to the end!

  • @MaxPenderuk
    @MaxPenderuk 9 місяців тому

    Dang, I love this coconut oiled shiny, amazing, super series💥
    Thanks a lot 💪

  • @ethanb4058
    @ethanb4058 2 роки тому +2

    you can also do "dib" to delete inside any kind of parens/braces which I find is easier than having to think about what kind of braces you're in or reach for "%"

    • @kjeksomanen
      @kjeksomanen Рік тому

      Oh man I've slept on the "ib" motion and the like, good call

  • @w0ntfix
    @w0ntfix Рік тому

    I learned alot of great tips here, and I've been using vim for a decade. Thanks

  • @sibouras792
    @sibouras792 2 роки тому +3

    you can use :keepjumps command to not store stuff in the jumplist
    map("n", "{", ":execute 'keepjumps norm! ' . v:count1 . '{'")
    map("n", "}", ":execute 'keepjumps norm! ' . v:count1 . '}'")

    • @aquepaique
      @aquepaique 2 роки тому

      ty, not sure why those jumps store by default, pretty useless

  • @scottiedoesno
    @scottiedoesno 2 роки тому

    I may have converted years ago at this point, but I always learn something useful from these!

  • @juanmacias5922
    @juanmacias5922 2 роки тому

    Bruh, your Vim videos are so mind blowing, looking forward to coming back and actually understanding half of what you did in this video lol

  • @GiorgosXou
    @GiorgosXou 2 роки тому +2

    At 6:42 you can also just do a '=] instead of >4j which is the "Smart paste Tip 1593"

  • @brendannolan2508
    @brendannolan2508 2 роки тому

    Listening to the audio only, without knowing anything about vim, is a wild ride.

  • @subbunittala2012
    @subbunittala2012 2 роки тому

    thanks so much brother ..you are my inspiration ..started using it since 1 week ..just loving it ! ....thanks again from INDIA ..this vim skill is MUST NEEDED !

  • @nullptr.
    @nullptr. 7 місяців тому

    Just an update, you can also use f with around or inner to select a function, as well as "a" for arguments (if you use treesitter). So for example, to delete a function you just do "daf" or "delete around function". To change the argument your cursor is over you do "caa" or "change around argument".

  • @JakobWillert
    @JakobWillert Рік тому

    Is this the Dr. Disrespect of the IT world? Nice content!

  • @lcarv20
    @lcarv20 2 роки тому

    I dropped my phone while watching this. Too much coco oil.
    Thanks sir, I am starting with vim and this is just needed. Would love one where you talk about what you think the “needed” plugins for a bare minimum vim setup are. Keep up the good work Maria.

  • @AbandonRule
    @AbandonRule 2 роки тому +1

    Glad I stayed to the end.
    BTW I still do :10000 to go to the end of the file just because It has a great result and I dont have to think about how to get to the end.
    Just saying since you learn something that is not 100% effective does not mean that it does not work.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому

      ... so you press G?
      but you are right, you don't have to do things the bestest, you have to do them the way you enjoy them the bestest

  • @feschber
    @feschber 2 роки тому

    One thing I started using a whole ton is capital J - blazingly fast line joining and useful in a lot of cases.

  • @AlexanderChernenko
    @AlexanderChernenko 2 роки тому +1

    I like it before I see it!

  • @FaraazAhmad
    @FaraazAhmad Рік тому +1

    o in visual mode is insane

  • @SvenHecht
    @SvenHecht 2 роки тому

    I recommend the "." command for the array asignments, at least if you use a single edit to do so: [uppercase I] [end] [esc]

  • @payton6_
    @payton6_ 2 роки тому

    Wow! I’m glad I stayed until the end!

  • @claudiafischering901
    @claudiafischering901 2 роки тому

    Thanks a lot for this video. I

  • @sck3570
    @sck3570 2 роки тому +1

    WOW ::::: Mind blown 🤯
    I didnt know about the ctrl + a
    and about the substitute abilities in vim and you can use regex like selection in it
    I will gladly use these new information in my beautiful blazingly fast VSCode VIM 🔥

    • @sck3570
      @sck3570 2 роки тому

      OH NO!!!! s/\(\w.*\)/data[0] = "\1";
      doest work in VSCode vim 😠

  • @yzeerkd
    @yzeerkd Рік тому

    Slight improvement (IMO) for that last very large array scenario - ]] will take you to the end of the array and [[ will take you to the start (same with ]} and [{ ). That said, the visual mode way shown works with more objects so one could argue it incurs less mental load by being more general.

  • @henrywang6931
    @henrywang6931 2 роки тому +1

    At around 5:30 mark, you could use nvim-treesitter/nvim-treesitter-textobjects which add functions and classes text objects. You could do for example daf to delete a function, or dif to delete inside of a function.

    • @ThePrimeagen
      @ThePrimeagen  2 роки тому

      yeah, but i am trying to avoid motion changing items I really worry about building unusable habits.

  • @korney4eg
    @korney4eg 2 роки тому +2

    Damn, man your motions were so fast, that playing video on 0.25 was not enough to understand some keystrokes.
    Seriously, I found some useful motions. Thanks and keep going!

  • @Taernsietr
    @Taernsietr 2 роки тому

    This one was meaty, gonna have to rewatch a few times to note everything lol (and now it's probably a good time to learn how to use Treesitter)

  • @jongeduard
    @jongeduard Рік тому

    Thanks! I did not yet know about that combination of the g key with that Ctrl a and x increment and decrement.
    However, I tried something really interesting too, might be worth sharing. And that is trying the 0x and 0b notations for hex and binary numbers, and it turns out that Vim recognizes that as well with this incrementing and decrementing. Very cool!

  • @shendypratama619
    @shendypratama619 2 роки тому +1

    lord coconut oil

  • @alexheslop2917
    @alexheslop2917 10 місяців тому

    Nice little custom normal mode command I have is +semi-colon, for all you c/cpp devs out there who are fed up going to the end of a line to add a semi-colon

  • @Grouiiiiik
    @Grouiiiiik 2 роки тому

    As for your last tip, one thing I end up using quite often is O to jump at the first or last line of a selection without leaving the visual mode.

  • @ExpertOfNil
    @ExpertOfNil Рік тому

    Sweet coconut oil infused goodness right here

  • @user-he4ef9br7z
    @user-he4ef9br7z 2 роки тому

    I'm just glad you returned to gruvbox.

  • @uolot
    @uolot 2 роки тому

    In 8:50 you don't even need a capture group as `&` in the replace segment of `:substitute` inserts the entire match. This would work: `:s/\w\+/data[0] = "&"/` and it's easier to type.

  • @oliverchalkley1187
    @oliverchalkley1187 2 роки тому +3

    Amazing content dude! I would love to hear your thoughts/strategy on macros?

  • @erickruhcardozo
    @erickruhcardozo Рік тому

    This video is good, the only down side is that you must watch in 0.25 speed.

  • @graxtheswampgoblinarchmage5356
    @graxtheswampgoblinarchmage5356 2 роки тому

    This guy's about convinced me to start using some archaic 30+ year old piece of software

  • @blackfrog1534
    @blackfrog1534 2 роки тому

    Prime making my workflow coconut oily smooth

  • @ofeenee
    @ofeenee Рік тому +1

    if I remember correctly, I heard you mention something about making a course (not tutorials like this video) to teach new developers vim. Is such a course available anywhere?

  • @salvadego7834
    @salvadego7834 7 місяців тому

    Glad I stayed till the end

  • @gonkong5638
    @gonkong5638 2 роки тому +2

    DAMNN.
    I was hesitate to gave up vim after my boss demand I switch to window and vscode like a "normal person".
    Fuck him.
    Those tips are killer, chief.

  • @wizardofounce129
    @wizardofounce129 2 роки тому

    This series taught me everything. Thanks

  • @Timjstewart
    @Timjstewart 2 роки тому

    And THAT is why you are the CEO baby!

  • @Nope-12485
    @Nope-12485 2 роки тому +1

    Your array example: I sadly would have just used a macro that completes the edit and moves the cursor down a line so I can spam @@ to repeat
    Why I love watching your videos. I learn different/new ways to solve my editing problems! Thanks @ThePrimeagen

  • @RootsterAnon
    @RootsterAnon 2 роки тому

    Glad I watched it till the end... 😄 I made myself a macro for that regex and oh boy, oh boy... coconut oil is dripping!

  • @nguyenthinhkhang
    @nguyenthinhkhang 8 місяців тому +3

    I have to turn the speed to 0.5x to follow your steps. It's blazingly fast...

  • @AnNguyen-vd8wv
    @AnNguyen-vd8wv 2 роки тому

    I really love your videos and TJ's videos, you guys really talk about neovim/vim. I hate other show-off guys always talk about their setup which is nobody F*king care

  • @danielkunkler7293
    @danielkunkler7293 9 місяців тому

    I can't wait until I'm this cracked out with vim

  • @unTanana
    @unTanana 2 роки тому

    Absolute 🔥🔥as always

  • @Luclecool123
    @Luclecool123 2 роки тому +1

    I was going to hit like just to notice I already did earlier in the video 😂

  • @byt3blitz
    @byt3blitz 2 роки тому

    Theo: "WHY ARE YOU WRITING UNIT TESTS😭". PRIME: "SUCK IT I LIKE THEM" lmfao! I learn so much from the vids and am entertained, all at the same time! Congrats on 100k