How to move around in Vim (for beginners) - Vim-Fu #1

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 60

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

    Once you're comfortable with the tips in this video, check out Vim-Fu #2 - How to edit efficiently in Vim: ua-cam.com/video/SO9Sre5v6NA/v-deo.html

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

    Nice job friend.

  • @isAif47
    @isAif47 4 роки тому +16

    You can use _ to move to the first non blank character of line, it's easier than 0w. Similarly g_ to move to last non blank character, this is not used much but it can be handy while creating macro for removing trailing space.
    Using Ctrl+f or ctrl+u can be disorienting when used for first time but it's very useful.
    Great video btw.

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

    This got randomly recommended to me by UA-cam. I had no idea you made UA-cam videos - how awesome!

  • @tobykelly4606
    @tobykelly4606 4 роки тому +4

    Thank you! I've always been interested in Vim but I've been waiting for the right beginners video. This is it! Subscribed.

  • @fliplucky8813
    @fliplucky8813 3 роки тому +3

    Great video. The way you present it is a lot more logical then the " standard" way. Great job!

    • @TheArtofSoftware
      @TheArtofSoftware  3 роки тому

      Thanks @FlipLucky. What do you mean by the standard way?

    • @fliplucky8813
      @fliplucky8813 3 роки тому +1

      @@TheArtofSoftware Well, ive looked at several videos, and most start with: hjkl, then bweE, going to g and gg, and then switch to edit skills etc.
      your approach to grouping the vertical commands, then the horizontal commands, instead of grouping movement by "skill level" makes it a LOT more beginner friendly.
      Personally, I found it frustrating that you have to "advance" through vim levels before you learn things like the f and search option, paragraph hopping with {} and moving the document

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

      Thanks for the reply, that's super useful to know. Glad it helped you

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

    Just what I needed. Some good. Normal mode practice.

  • @BenKadel
    @BenKadel 4 роки тому +3

    Great video dude! Loving the (I wanna say new intro, unless uve had it all the time and I've just missed it haha)
    Quality Vim-Moving!

  • @gauravparvat5291
    @gauravparvat5291 4 роки тому +5

    Great tutorial. I wish I had found it earlier this year when I was struggling to learn vim, because of the lack of "absolute beginner friendly" materials; I had to skim through articles, posts, and sometimes documentation. But here we are, I still watch materials I already know, just to have an idea how other people utilize what I am using, if they are more efficient (or cooler) then I'll adapt things their way. One suggestion though, marks should be included in vim navigation category. When used right, can be THE fastest way to navigate back and forth between things. In my head, marks feel like cursor teleporting. Although marks are harder to incorporate into your daily workflow, they're good to know.

    • @TheArtofSoftware
      @TheArtofSoftware  4 роки тому

      Yes, marks are great and I don't use them often enough. Thanks for the kind words!

  • @richardvdoost
    @richardvdoost 3 роки тому +7

    Great explanation 👌
    Another shortcut I like for vertical movement is: zz
    It moves the cursor to the middle of the screen by scrolling the entire doc (leaving the cursor on the same line #)

  • @AmnesiaPhotography
    @AmnesiaPhotography 3 роки тому

    Great straight forward video!

  • @emeiri1
    @emeiri1 4 роки тому +1

    Great tutorial. Thank you.

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

    Great explanation

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

    Gold. Thanks for sharing.

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

    Wonderful video!

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

    How do you prevent it from typing the commands you're inputting? Eg for "gg", how do you make it do the command instead of it typing out gg?

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

      use commands in normal/command mode
      his ESC or Ctrl-C from insert mode to switch modes to normal

  • @HH-ez6qc
    @HH-ez6qc Рік тому

    Fantastic video!

  • @suriyakumar3434
    @suriyakumar3434 11 місяців тому

    Great video

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

    How can i move my cursor to the last recent position?
    Ex: I am now at line number 30. I enter 67G. How can I move to line 30 ? And I don't know that at which line i was before.

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

      ctrl+o -> Jump to previous location (jump back)
      ctrl+i -> Jump to next location (jump forward)

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

    from my experience the biggest slow down for me is moving from insert to normal mode.. I always remap my escape key to "hh" coz i use dvorak which is also "jj" for qwerty.

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

    Remapping my arrow keys to nop is a great tip! Just did that!

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

    A - is what i am looking for to enter that pesky semicolon at the end! thanks!

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

    7:46 I'm overweight and can't resist the cookies... you just removed like half of my daily exercise.

  • @tonybengue
    @tonybengue 3 роки тому

    I thank you for those tips. When there will be new videos? Your content is great ;)

    • @TheArtofSoftware
      @TheArtofSoftware  3 роки тому

      Hi Tony, thanks, really trying to get back on it soon!

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

    Great vid!

  •  Рік тому

    thank you very much!

  • @TheVikke2
    @TheVikke2 3 роки тому +10

    w => start of the word
    e => end of the next word
    b => backwards to the start of the word
    3w => number before command to execute multiple times
    yy => copy a whole line
    y => copy selection
    p => paste
    Shift + p => paste on top of current line
    u => undo
    dd => delete and cut a line
    cc => delete and cut a line, puts you to insert mode after the command
    i => engage insert mode and go left
    a => engage insert mode and go right
    0(zero) => move to start of the line
    Shift + ^ => move to first character on the line
    Alt + 4 (aka $) => move to end of the line
    Shift + 5 (aka %) => move to corresponding bracket, toggle brackets
    f + h (character) => go to first occurrance of a character on a line
    Shift + F => go to first occurance of a character on a line backwards
    /searchterm => to type across the file, press Enter to go to the first result
    ?searchterm => search backwards, press Enter to go to the first result
    n => go to next search result
    Shift + n => go backwards in search results
    v => engage visual mode, selects text
    Shift + v => visual mode with lines selection
    < > => in visual mode change the intention
    . => to repeat latest command
    Shift + ` => visual mode changes the case of the word
    v + i + w => visual mode select a word
    Ctrl + v => visual multi-line select
    Ctrl + u => move half a page up
    Ctrl + d => move half a page down
    Shift + 8 or 9 => move to ( or )
    Alt + 7 or 0 => move to { or }
    Shift + h => move to highest point of viewport
    Shift + m => move to middle point of viewport
    Shift + l => move to highest point of viewport
    :200 => go to line 200
    d + t + (character) => delete everything until this character

    •  Рік тому +1

      Thank you very much! This goes straight into my cheatsheet file. :D

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

    Great video, btw what font are you using for vim?

    • @MM-um7pt
      @MM-um7pt 11 місяців тому

      Ubuntu mono

  • @thangphan6047
    @thangphan6047 3 роки тому

    Thank you so much

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

    Thank you

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

    using { and } messes with your jump list, and then when you wanna jump back and forth between your jump list (for example going back from LSP's "go to definition") it becomes a pain in the ass
    I don't recommend it

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

    Tbh just do the vim tutor and learn by usage or nvim tutor if you prefer you will learn with time what works and what doesn’t

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

    6:11 where i left off for later.

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

    You really need relative line numbers

  • @ciwKCG
    @ciwKCG 4 місяці тому

    `relativenumber` would be like: why you not even consider me??? T____T (crying) ..lol

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

    The legendary "Jet Li" is now a coder!!

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

    Very nice job. That said, you seem too bright to be mispronouncing "regex". As it is shorthand for "regular expression", you should obviously pronounce is accordingly as you (hopefully) would not ever speak of a "rejular expression". To be honest, I see this as just one of many examples in our very competitive field where people essentially mimic (copy/paste) popular terms and lingo in an effort to seemingly fit in. With that out of the way, I'll just add that using command mode to jump to a given line is better than prefixing G with a number. The reason using command mode is better is due to the fact other operations like move, copy, etc can be used. For example, one can easily move a text object 10 lines up with :-10m

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

    Are you chubby emu's programmer cousin

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

    🤣🤣vim fu

  • @Topyy
    @Topyy 11 місяців тому

    Why do you look so much like chubbyemu 😭

    • @MM-um7pt
      @MM-um7pt 11 місяців тому

      I'm his dad

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

    word and google docs is far from perfect, but this is not the solution...

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

    :set nu rnu