Understanding The Vim Registers

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ย. 2024

ความคิดเห็น • 65

  • @FredMaterias
    @FredMaterias 4 หลายเดือนก่อน +3

    I'm even more impressed with the fact that I learned that the symbol "#" is called octothorpe

  • @ablanchi
    @ablanchi 4 ปีที่แล้ว +24

    that macro edit is GOLD

  • @user_null3696
    @user_null3696 5 หลายเดือนก่อน +6

    7:45 The small delete register stores deleted characters (content within a line), whereas numbered registers are used to store deleted lines.
    The reason s, x, X, c, C, d, D work is because they delete characters, whereas dd, S delete a line
    It is very useful because it can store content of commands like "diw", whereas numbered registers cannot.

    • @noabstruction
      @noabstruction 5 หลายเดือนก่อน +1

      Thanks null

  • @WebLego
    @WebLego 4 ปีที่แล้ว +23

    Black hole register is also very useful when writing vim script / plugins and you wish to not change the state of the users registers when performing some commands.

  • @9bnmadden
    @9bnmadden 2 ปีที่แล้ว +9

    I have watched this four times in the past year! What an awesome video which definitely leveled up my vim game! Thanks for the great tutorial.

  • @princeofexcess
    @princeofexcess 6 หลายเดือนก่อน +1

    for black hole register. if you deleted something you want to paste but on the way to pasting you encounter something you want to delete, i use the black hole register so I dont override my previous delete/yank.
    In my nvim i have a command setup just for this so i can keep pasting without overriding what im pasting.
    I will select something i want to paste over then do p to paste over it. with just p whatever i had selected would end up in my unnamed register so i loose my original yank.

  • @alexandrostsagkaropoulos
    @alexandrostsagkaropoulos 10 หลายเดือนก่อน +1

    I was searching for this kind of video for ages. Thanks for the good work!

  • @velizarbodurski6005
    @velizarbodurski6005 2 ปีที่แล้ว +9

    another fun detail with named registers (such as "a, "b) is that they are aliased also to "A and "B, and when you yank & delete into "A - you're appending text the corresponding named register (not replacing its content, which would happen if you use "a)

    • @mattetis
      @mattetis 9 หลายเดือนก่อน

      Is it possible to append easily to the unnamed as well? (Like without pasting the contents first and then yanking?)

  • @guyindisguise
    @guyindisguise 4 ปีที่แล้ว +9

    14:35 Instead of using Ex-mode and copying the last command with :: you can just type @: from normal-mode (I somehow learned this by accident)
    PS: great video, I learned a lot!
    edit:
    it's even in the vimhelp
    :h @:
    @: Repeat last command-line [count] times.
    {not available when compiled without the
    +cmdline_hist feature}

  •  4 ปีที่แล้ว +7

    Super clear and actually entertaining explanation, thanks.

  • @diarmaidmac2149
    @diarmaidmac2149 3 ปีที่แล้ว +2

    The audio quality is refreshingly good! Nice video too! Thanks!

  • @zach1912XD
    @zach1912XD 7 หลายเดือนก่อน

    my favorite black whole usage is when I want to keep something in the unnamed register but I also want to delete something, _"d is often a very natural way to accomplish it

  • @WebLego
    @WebLego 4 ปีที่แล้ว +21

    Instead of using ^r =system('ls'), in normal mode you can do :r !ls Where r is for the read and insert command

    • @glenn8459
      @glenn8459 ปีที่แล้ว +2

      Or you can do !!ls in normal mode which is very useful

  • @al-du6lb
    @al-du6lb 4 ปีที่แล้ว +1

    Based. I'm definitely going to have to watch this again.

  • @sevos
    @sevos 7 หลายเดือนก่อน

    At long last I found a video that doesn't just explain which reg is which, but actually makes real life usage examples

  • @anishkapatel8393
    @anishkapatel8393 ปีที่แล้ว

    awesome video just brushed up my vim reg knowledge
    editing macros was eye opener
    cant even tell you how many times i had to redo macro recordings

  • @cindysi63
    @cindysi63 6 หลายเดือนก่อน

    So many useful tips. Love the tip on editing macro!! Thank you

  • @ryanwwest
    @ryanwwest 11 หลายเดือนก่อน

    The selection register timestamp got pulled into the black hole register too. Lol but great video.

  • @jevessonsouza7947
    @jevessonsouza7947 ปีที่แล้ว

    A huge THANK YOU!!!

  • @jiangpengli86
    @jiangpengli86 2 หลายเดือนก่อน

    Great tutorial🎉 Thank you❤

  • @JoePescisAngryCousin
    @JoePescisAngryCousin ปีที่แล้ว

    This video is fantastic. Thank you.

  • @gjermundification
    @gjermundification 2 ปีที่แล้ว

    Named registers explained really well.

  • @lindat.7097
    @lindat.7097 4 ปีที่แล้ว +2

    Great video! Thank you!!!

  • @nghialm269
    @nghialm269 4 ปีที่แล้ว +7

    29:34 You can just leave the search pattern empty, vim will automatically use the last search register.

  • @sussusamogus7831
    @sussusamogus7831 7 หลายเดือนก่อน

    great video, tyvm

  • @ChrisCox-wv7oo
    @ChrisCox-wv7oo ปีที่แล้ว

    This is fantastic, subbed for life

  • @regvud
    @regvud 6 หลายเดือนก่อน

    Thx for sharing

  • @comod
    @comod 29 วันที่ผ่านมา

    21:18 this is the real vim experience

  • @kevinchang9616
    @kevinchang9616 4 ปีที่แล้ว +1

    Very helpful video, thank you!

  • @konradchyrzynski8326
    @konradchyrzynski8326 8 หลายเดือนก่อน

    Thanks for the video :)

  • @serhiibudnik4379
    @serhiibudnik4379 ปีที่แล้ว

    that was interesting, thank you

  • @stracci_5698
    @stracci_5698 2 ปีที่แล้ว

    Vim just keeps on giving

  • @devonmorris1992
    @devonmorris1992 4 ปีที่แล้ว

    This is beautiful. I need to spend more time on those vim help pages.

  • @bronekszulc3272
    @bronekszulc3272 3 ปีที่แล้ว

    This video was super valuable to me

  • @michaelbaumeister4900
    @michaelbaumeister4900 ปีที่แล้ว

    Very helpfull, thank you.

  • @devgalileu
    @devgalileu 11 หลายเดือนก่อน

    Awesome content!

  • @theemacsen1518
    @theemacsen1518 4 ปีที่แล้ว +7

    Dude you have a great voice lmao XD

  • @JohnBortins
    @JohnBortins 3 ปีที่แล้ว

    Outstanding!

  • @shashanksharma21
    @shashanksharma21 3 ปีที่แล้ว

    brilliantly explained, thank you !

  • @tiagodejesus456
    @tiagodejesus456 ปีที่แล้ว

    Great video!

  • @miaomiao1415
    @miaomiao1415 3 ปีที่แล้ว

    I would say thank you !

  • @PalinuroRex
    @PalinuroRex 2 ปีที่แล้ว

    Soooo useful.

  • @matthewrease2376
    @matthewrease2376 ปีที่แล้ว

    I have + and * configured to be different clipboards. I use KDE on my system, so one of them copies to klipper, but I don't *always* run KDE on my system, so the other one copies to xclip.

  • @slipcurve1410
    @slipcurve1410 3 ปีที่แล้ว

    this was great. also you have a amazing radio voice.

  • @scifregizmoguy
    @scifregizmoguy 4 ปีที่แล้ว +2

    10:33 Definitely could have used the command-line-window there to avoid awkward editing.
    :help cmdwin

  • @WebLego
    @WebLego 4 ปีที่แล้ว

    Maybe I missed it, but after googling the smaller delete register is accessible via "-

  • @saltrocklamp199
    @saltrocklamp199 4 ปีที่แล้ว

    The behavior of % in ex mode is to splice in and modify the contents of the "% register without needing to type ctrl-r%. Is that behavior unique to %?

  • @0xssff
    @0xssff 3 ปีที่แล้ว

    thanks a lot

  • @_jdfx
    @_jdfx 3 ปีที่แล้ว

    amazing!

  • @sumanth3036
    @sumanth3036 ปีที่แล้ว

    Love

  • @pav5000
    @pav5000 4 หลายเดือนก่อน

    12:00 OMG, these macros are like multicursor but so much worse. Because it's very easy to accidently mess it up and takes a long time to fix your mistake. When using multicursor you see the result immediately and can undo your last action and just use another.

  • @al-du6lb
    @al-du6lb 4 ปีที่แล้ว

    7:31 did you mean 3 hundred thousand "words" ? You did a great job with this video btw.

  • @rashie
    @rashie 2 ปีที่แล้ว

    👍👍

  • @swagatbaruah522
    @swagatbaruah522 3 ปีที่แล้ว +1

    can u tell : "How to clear the register" when its really messy

  • @no_name4796
    @no_name4796 10 หลายเดือนก่อน

    10:35
    This is a bad example, since you can just record a new macro and do: @aA,j

  • @asdiasx
    @asdiasx 3 ปีที่แล้ว +2

    Great video! Thanks ( please consider speaking a little slower... ;) )

  • @421sap
    @421sap 9 หลายเดือนก่อน

    God bless you in Jesus' Name Amen ✝️

  • @serhiibudnik4379
    @serhiibudnik4379 ปีที่แล้ว +2

    I use Blackhole for x key because it's annoying to have last char in register every time :)
    (keymap.set("n", "x", '"_x'))