30 Vim commands you NEED TO KNOW (in just 10 minutes)

  Рет қаралды 53,729

typecraft

typecraft

Күн бұрын

To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/typecraft . You’ll also get 20% off an annual premium subscription.
*This video was sponsored by Brilliant*
X: / typecraft_dev
We've got a slew of shorts on Vim tricks but in this episode, we're going hard in the paint with 30 Vim commands you NEED TO KNOW. In ten minutes, your neckbeard will grow faster than ever before.
Let's get after it.
Chapters:
0:00 - intro
1:00 - search and replace
3:30 - visual higlighting yanking, registers
6:20 - special registers
8:20 - macros!

Пікірлер: 151
@typecraft_dev
@typecraft_dev Ай бұрын
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/typecraft . You’ll also get 20% off an annual premium subscription.
@23luski23
@23luski23 Ай бұрын
/g in sed command means global in line, not in entire file. So without /g replacement will be done for the first occurrence in each line where we have matching
@zerdofish9989
@zerdofish9989 Ай бұрын
Indeed! What makes it global is the %
@eivindsulen8516
@eivindsulen8516 Ай бұрын
@@zerdofish9989 when i first learned this i realized you can select lines in visual mode and run substitute on just this range of lines. :'
@matiasbpg
@matiasbpg Ай бұрын
To add to the %, this is really a range, that means the whole buffer. Most commands accepts a range at the beginning and there are a few shortcuts for ranges: :x,y. from lines x to y : .,y '.' means the current line so it's current line to y :'
@silak33
@silak33 Ай бұрын
Thought the exact same thing XD
@zerdofish9989
@zerdofish9989 Ай бұрын
Thsnks! I didn't know this.
@ivanheffner2587
@ivanheffner2587 Ай бұрын
Did you know you can append to a named register? “xY will yank the current line into register x. “XY will append the current line to register x. This lets you build up a register to paste later. For example: you want to grab a couple lines of code from several locations and paste them into a new function, you can gather them all into that register and then do one paste when you have them assembled. Also, because a macro is just executing a register, you can edit a macro by pasting the contents of the register, modify it, then yank the new macro back into the register ready to run the modified macro. One last item: a macro can call another macro or even itself. Writing recursive macros to update thousands of lines can be quite satisfying, but is most useful if making a regex substitution is just too difficult or not quite fully repeatable.
@marcuswest4572
@marcuswest4572 Ай бұрын
Sounds like a video in itself
@CoClock
@CoClock Ай бұрын
Macros are executing registers!!!!?!
@ivanheffner2587
@ivanheffner2587 Ай бұрын
@@CoClock 🤯 right? Try it yourself. Record macro x qxcawfooq Paste the contents of register x “xp
@silak33
@silak33 Ай бұрын
On the subject of upper case registers. If you record to an upper case register you will append to what is in that register rather than replace it. That is very useful if you forget something :)
@eugeneponomarov7429
@eugeneponomarov7429 16 күн бұрын
Omg, this is super powerful!
@typecraft_dev
@typecraft_dev Ай бұрын
🚨 I misspoke!! 🚨 Typically with Vim videos, I tend to do them from top-of-my-head knowledge. For some reason, I always think of the "substitute" command as "sed". "s" is substitute, not "sed" sorry for any confusion, hope you like the video!!
@wh7988
@wh7988 Ай бұрын
thank u daddy, took the vim pill because of u
@user-wy1xm4gl1c
@user-wy1xm4gl1c Ай бұрын
awesome video, thank you for the macro ;) all devs should love it
@RobertGottlieb
@RobertGottlieb Ай бұрын
Another way I've seen this done is :0,$s/find/replace/
@WhiteRickRoss
@WhiteRickRoss Ай бұрын
v + i + w + y (to copy the selected word) can be done with y + i + w (yank inside word)
@andreirost4696
@andreirost4696 21 күн бұрын
Or if ur at the beggining of a word just yw
@code-island
@code-island Ай бұрын
bring the part 2 with more 50 commands
@typecraft_dev
@typecraft_dev Ай бұрын
You got it
@realbyte2048
@realbyte2048 Ай бұрын
Thanks moustache man, I needed this.
@johnathonme
@johnathonme 12 сағат бұрын
OMFG WTH!! I've been using vi then vim and now nvim for 30 years and I didn't a know a couple of these commands and the diff between the registers. Omg!! Thanks loads for the video @typecraft and love all the other comments from folks with good tips, vi just never stops giving
@danks4
@danks4 Күн бұрын
I’ve been using nvim for over a year and learned multiple things from this video. Thanks so much!
@priyanshukatuwal
@priyanshukatuwal Ай бұрын
I am a beginner, I hated VIM at first and I told myself I would never touch it again. But I kept learning things little by little. Your channel helped me a lot, it has made me fall in love with VIM. I am also following your playlist to learn to make my own Neovim config. Thanks nerd!
@holdthat4090
@holdthat4090 Ай бұрын
will toggle between the current and previous buffers, you can mash it to go back and forth kinda like harpoon. Also lets you go backwards in the jump table if you wana navigate back a line or two or three etc.
@willernst
@willernst Ай бұрын
And the pairing to travel back forward in the jump table (use "o"ut and "i"n as the mnemonic).
@PalashBackup
@PalashBackup Ай бұрын
Although purists will say you only need tutor, I think these style of videos are more encouraging, especially for newbies.
@jamesaffleck4192
@jamesaffleck4192 Ай бұрын
Great tips! With macros you can do @@ to replay last played macro. Also while recording a macro,.you can also replay that macro inifonitely until vim.encounters an error. I.e. for your example qah //start recording into h i"E", // addquotes around word, then add comma @h //.start replaying entire macro recursively, i.e. this will keep replaying the 'h' macro until error encountered. A couple more register tips. Add to init.vim or .vimrc set clipboard unnamedplus //Always yank/paste from system clipboard. One register tip: "_d //delete without overwriting default register In visual mode.ypu can do P to paste without overwriting. Here's a couple other honorable mentions. Use the global command to delete all lines containing search. :g/search/d And its inverse (delete lines not containing search) :!/search/d
@mischavandenburg
@mischavandenburg Ай бұрын
Hi! I’m a content creator in the same space, and I really appreciate the quality of your videos and the work it requires to create them. This video is a great guide for beginners and showcases the power of vim editing in such an effortless way, Keep up the good work!
@typecraft_dev
@typecraft_dev Ай бұрын
Thanks!!
@kevinrineer5356
@kevinrineer5356 3 күн бұрын
Thanks for the stuff about registers. Ive been heavily using vim for 3 months and hadnt come across the need for it, but i can see where it will be useful
@afzalhussain5728
@afzalhussain5728 Ай бұрын
Great video, as always! One quick note - ":s" stands for "substitute" in command mode.
@typecraft_dev
@typecraft_dev Ай бұрын
ugh you're totally right! (and not the first to point this out). With vim stuff, I tend to do this from the top of my head. for some reason "s" has always been "sed" in my head :)
@brynana_dev
@brynana_dev Ай бұрын
Impressive (both the commands and the moustache)
@typecraft_dev
@typecraft_dev Ай бұрын
Thanks!
@sebastianalfaro1887
@sebastianalfaro1887 Ай бұрын
Best vim learning serie in KZfaq! BTW loved your Patagonia t-shirt, cheers from Argentina
@RuanBekker
@RuanBekker 15 күн бұрын
This was exactly what I was looking for! I've been using vim for the last 10 years, but ive always used the basics and what I have to use to get the job done. This is going to take me to the next level. Your videos are amazing, and I thank you for them!
@tenminuteamateurhour
@tenminuteamateurhour Ай бұрын
Thanks, learned some new things! You can also create an autocommand to briefly highlight whatever you're yanking. Then you don't need to go into visual mode first.
@MR_Stick
@MR_Stick Ай бұрын
Some of these are really a life saver, great video.
@zandivx
@zandivx 24 күн бұрын
As in Vim/Neovim it is very important whether a letter is capital or not, it might confuse people if you display capital letters in the overlay in instances where in fact they are not capital
@SteeleMan223
@SteeleMan223 Ай бұрын
Just started the neovim journey this week. This was very helpful
@joergw
@joergw Ай бұрын
very helpful, thanks I really like your tutorials
@xiaoliu6973
@xiaoliu6973 Ай бұрын
Great video. I have learned new things.
@mraaroncruz
@mraaroncruz Ай бұрын
Long time vim user and never knew about * I always get value out of your videos. Thanks a lot!
@MattRobinsonDev
@MattRobinsonDev Ай бұрын
Another great video as always
@cristhianjhlcom
@cristhianjhlcom 18 күн бұрын
Hey man I just found your channel and I think is amazing! Thank you 💯💯
@user-me8dk7ds7f
@user-me8dk7ds7f Ай бұрын
you can press '#' in order to select previous occurrence of a word, '#' the complementary of '*'.
@binh1298ify
@binh1298ify Ай бұрын
Thanks man, I learned some new things
@marcodem3
@marcodem3 Ай бұрын
I used vi for 35 years now and I got quick and efficient, vi under my skin. I didn't miss anything until now I know what i could have missed :-) Thanks a lot!
@wiseskeshom4673
@wiseskeshom4673 Ай бұрын
Thank you so much, I learned a lot from this video.
@CHAP_SEC
@CHAP_SEC 18 күн бұрын
My mind has been blow. I know vim/nvim is powerful, didn't realise just how amazing ot could be. Admittedly, i wont be able to remember all of this, but i will probably start using nvim :). Then slowly learn these as i need them
@datacentrico
@datacentrico Ай бұрын
Awesome dude. I moved to NVIM for data science just by watching your content. I't been a wild ride.
@typecraft_dev
@typecraft_dev Ай бұрын
Welcome brother
@Viken43
@Viken43 Ай бұрын
Macros ftw thanks typecraft 😊
Ай бұрын
After selecting something, performing any change, you can go elsewere and press 1v to repeat the same selection pattern.
@kashperanto
@kashperanto Ай бұрын
Also for macros, once you run @h (or whichever register you're using) you can just type @@ to run it agan. I usually do a ballpark guess, like 5@h, and then just hit @@ to finish the last few lines. Macros also work with search, so it is much more capable than just editing big contiguous sets of lines.
@sirhopcount
@sirhopcount Ай бұрын
Excellent video 👍
@typecraft_dev
@typecraft_dev Ай бұрын
Thank you! Cheers!
@Laggedskapari
@Laggedskapari Ай бұрын
Will love a video specially for nvim macros…..and as always Thanks Nerd!
@ayeayepost
@ayeayepost Ай бұрын
Here is a super-duper pro tip (blazingly fast and free as GPL3) "Use Alt key with commands in INSERT mode" this is the foundation of the forgotten typing art, revive it to unleash full power of the modal text editor :)
@chandraprakashdarji
@chandraprakashdarji Ай бұрын
Great video
@TheLANBeforeTime-uo9ph
@TheLANBeforeTime-uo9ph Ай бұрын
not sure what I can learn from it but I know there will be. Liked, bookmarked for later watching! Peace out.
@roniqueh96
@roniqueh96 25 күн бұрын
oh and another tip with macros that's powerful is to combine it with the norm command in visual mode. so instead of 5@a to perform the macro for the following 5 lines, I'll just make a visual selection of the lines I want to apply the macro to, hit colon then 'norm @@' to apply it on each line. similar can be done with the dot command, 'norm .' to perform the last change on every line (i remap this to g. )
@beastade
@beastade Ай бұрын
You could replace selection with cgn command. If you repeat it with dot then it replaces the next occurrence..
@amandin.
@amandin. Ай бұрын
the special clipboard register that is linked with the system clipboard is a + on windows, too.
@rphyt
@rphyt Ай бұрын
I don't mean to be pedantic but :s stands for :substitute not sed. Also in that command the '%' sign is used to tell :substitute to work on the entire file. The /g option, instead, means operate globally on the line.
@NilEoe
@NilEoe Ай бұрын
%s already targets the whole file, the /g (global) replaces every occurrence of the word, not just the first of every line Super helpful video though! Didn’t know how to use registers, thanks a lot!
@SecretAgencyOfGaming
@SecretAgencyOfGaming Ай бұрын
Thanks nerd! You taught me a lot!
@blocSonic
@blocSonic Ай бұрын
Thanks. You rock!
@typecraft_dev
@typecraft_dev Ай бұрын
awwww :)
@kodder
@kodder Ай бұрын
Linux has the + and * registers for the system. Since it has two different clipboards active at the same time usually. One is the one you use with ctrl+c/v and the other one is highlight and middle click.
@windowsrefund
@windowsrefund Ай бұрын
Your videos are addicting. Being a big fan of motions, I often wonder why people typically use ciw to change a word rather than ce?
@roniqueh96
@roniqueh96 25 күн бұрын
because ciw doesn't care where in the word your cursor is. ce = ciw only when your cursor is at the beginning of the word
@windowsrefund
@windowsrefund 25 күн бұрын
@@roniqueh96 Yes, I remembered this later that day and couldn't agree more. It only makes sense in the event you're on the first character of the word.
@silak33
@silak33 Ай бұрын
Should be mentioned the 0-9 registers doesn't quite work as you mentioned here. 0 will always contain the last yanked text, but 1-9 will only be populated if the text deleted is bigger than one line.
@sirka0s
@sirka0s 14 күн бұрын
Nice video! What is this prompt you are using btw, looks gorgeous!
@marcuswest4572
@marcuswest4572 Ай бұрын
Great content.If there was a handy file, we could practice & learn simultaneously
@mascapt4231
@mascapt4231 13 күн бұрын
Nice video, just one thing : Register copy commands ("+y") on the system clipboard will not work on some Linux system with wayland. You can reproduce this problem on a fresh install of fedora 40 . The reason ? -> no Wayland clipboard, you can fix it with your package manager in your linux distro , (Red Hat land : sudo dnf install wl-clipboard). This is pretty bad to not have that by default. It is better on any system to check clipboard support before trying to do that.
@zerdofish9989
@zerdofish9989 Ай бұрын
I think that :s is for substitute and not sed. Not an important detail but I think it's better to clarify so then when invoking the :help command one looks for :help substitute. Thanks for the great content!
@srt_
@srt_ Ай бұрын
that yellow light is causing camera to change focus. kind of distracting. BTW, awesome episode. Learnt some new things.
@anthonycoutinho102
@anthonycoutinho102 Ай бұрын
Thanks nerd, congrats about the new sponsor
@MatiasBaldanza
@MatiasBaldanza 5 күн бұрын
Outstanding. I have a questions. The % register, in my mac, holds the full path and filename. How do I access just the filename and extension without the absolute path? (Been looking for it, but can't see if this is a setting or I have to look elsewhere.)
@AkarshanBiswas
@AkarshanBiswas Ай бұрын
I really liked your alacritty setup... Maybe I should install and configure too. :)
@typecraft_dev
@typecraft_dev Ай бұрын
Go for it!
@AkarshanBiswas
@AkarshanBiswas Ай бұрын
@@typecraft_dev Done!
@user-me8dk7ds7f
@user-me8dk7ds7f Ай бұрын
Is there any way to configure vim buffer font, without setting the font of the terminal? I mean to have two different fonts for vim and the terminal that runs vim.
@midjhelins8383
@midjhelins8383 3 күн бұрын
excellent!
@Cleanblue1990
@Cleanblue1990 Ай бұрын
Finally i know how to exit vim
@himquantum
@himquantum 8 күн бұрын
Thank you, Nerd
@Dainslief31
@Dainslief31 Ай бұрын
Thanks Nerd
@SamSepiol127
@SamSepiol127 Ай бұрын
actually, I don't remember if is actually my own config cause I set it up a few years ago, but for me "%p paste the absolute path(plus the name)of the file I'm currently in and imoo is kinda useful if you need to paste that to variables and stuff. Great video btw
@ivanheffner2587
@ivanheffner2587 16 күн бұрын
This is a built-in for vim (maybe even OG vi). It pastes from the % register, which contains the current buffer’s filename.
@thayto_dev
@thayto_dev Ай бұрын
the `*` blew my mind
@ivanheffner2587
@ivanheffner2587 Ай бұрын
You should also try #. It has the same thing as * but in the opposite direction. But remember: n and N on according to the direction of your previous search.
@Lars-ce4rd
@Lars-ce4rd Ай бұрын
"I assume that you know some basic things like hjkl" Then proceeds to explain hjkl lol
@timjames4306
@timjames4306 Ай бұрын
Please also make a video on how to config nvim with Django
@ericlindell3777
@ericlindell3777 Ай бұрын
Fantastic vid! Instant click.
@yasengo
@yasengo Ай бұрын
How to solve issue when installed packages modules are being shown in suggestion while jsx module is not suggesting .
@w01dnick
@w01dnick Ай бұрын
8:43 or use %w (in this case)
@w01dnick
@w01dnick Ай бұрын
You don't use relative line numbers, do you? A lot of people recommend them but TBH I don't feel comfortably with them for some reason.
@typecraft_dev
@typecraft_dev Ай бұрын
Yeah never used them
@devbysojay
@devbysojay 16 күн бұрын
hello sir , "LanguageTree:for_each_child() is deprecated, use LanguageTree:children() instead. :help deprecated Feature will be removed in Nvim 0.11" this is occurring in my neovim 0.10 . please ! can you fix it
@KevinNitro
@KevinNitro Ай бұрын
Hi my lord. Your terminal status line style is very cool. I love catppuccin :) Could you share your config? I would really appreciate that
@jaddadzakaria
@jaddadzakaria Ай бұрын
we are all friends in this community, much love man 💜
@rafa6536
@rafa6536 Ай бұрын
Don't know how to get CSS classes project wide autocompletion and HTML syntax highlighting in Twig files, I gave neovim a chance but I lost :P
@gjermundification
@gjermundification Ай бұрын
9:48 Then again you forgot to `:set nu rnu` what is the use of being able to do stuff n times without rnu?
@Zipperheaddttl
@Zipperheaddttl Ай бұрын
man it really feels like you are trying to channel Prime from the bottom of you toes. Thanks nerd.
@heroclix0rz
@heroclix0rz Ай бұрын
I'm just wondering what's about to happen in 10m that will require I know vim so well.
@hey_james
@hey_james Ай бұрын
Is the moustache a requirement now if you have a developer youtube channel?
@mahirabbas3700
@mahirabbas3700 Ай бұрын
thanks nerd. ill go get a brilliant subscription.
@miron5733
@miron5733 Ай бұрын
Why not just use clipboard = "unnamedplus"? 7:30
@typecraft_dev
@typecraft_dev Ай бұрын
You totally can. Just wanted to show off how it happens under the hood
@saeedxgholami
@saeedxgholami Ай бұрын
It doesn't matter when, I always laugh when I hear LEADER....
@Dorian781227
@Dorian781227 Ай бұрын
Can someone explain to me why this man has only 37k sub ?
@simonlauer9379
@simonlauer9379 Ай бұрын
thanks nerd!
@glavataa
@glavataa 12 күн бұрын
Going into Pane mode, Ctrl+P, then hjkl moves around, ESC when done
@INFClockBlock
@INFClockBlock Ай бұрын
i used vim cause no more mouse but no one talks about vertical movement
@imnotapartygoer
@imnotapartygoer Ай бұрын
How do i exit
@PetrenkoAndrii
@PetrenkoAndrii Ай бұрын
I am first to comment! Ha ha! Nice video!
@typecraft_dev
@typecraft_dev Ай бұрын
You did it!
@MarcoAntoniotti
@MarcoAntoniotti Ай бұрын
Isn't M-x evil enough? 🤔
@KevinNitro
@KevinNitro Ай бұрын
Ouh are you using Fedora or Arch my lord nerd?
@typecraft_dev
@typecraft_dev Ай бұрын
Arch (btw)
@yaarooruvan4310
@yaarooruvan4310 Ай бұрын
camera focus is not good sometimes btw thanks nerd!
@typecraft_dev
@typecraft_dev Ай бұрын
OMG I KNOW it was so annoying. Fixed it though. I recorded this BEFORE the last two videos, its better now
@zeocamo
@zeocamo Ай бұрын
What was the s in %s again?? It is not the set command 😁
@typecraft_dev
@typecraft_dev Ай бұрын
substitute :)
@zeocamo
@zeocamo Ай бұрын
@@typecraft_dev gold star
@ivanheffner2587
@ivanheffner2587 16 күн бұрын
Technically the command is :s, which takes a range. % is the range; the equivalent of 1,$ (first line to last line).
@zeocamo
@zeocamo 16 күн бұрын
@@ivanheffner2587 we all know that, we was talking about the s
@lieksu
@lieksu Ай бұрын
Video is helpful. Going in and out of focus is a bit disturbing tho.
@TheGogiu
@TheGogiu Ай бұрын
Thanks nerd
@peterkois4858
@peterkois4858 Ай бұрын
Super video, but please turn off that autofocus or move hands less😂
@typecraft_dev
@typecraft_dev Ай бұрын
Ugh I know! It’s fixed now at least
@BlackwinghacksBlogspot
@BlackwinghacksBlogspot Ай бұрын
Editor, add more tattoos 😈😈😈
@sanib.8818
@sanib.8818 10 күн бұрын
Vim tutorials on youtube are great, except for one thing. if you want to follow along.. and try the same commands and make sure you are competent in both muscle memory and thinking speed, you need the same file to work on as the one the person is demonstrating on in the video. .
@Cool-Linux-Penguin
@Cool-Linux-Penguin Ай бұрын
Noo I am 8 hours late.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 35 М.
From 0 to IDE in NEOVIM from scratch | FREE COURSE // EP 1
19:48
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 84 МЛН
WHY DOES SHE HAVE A REWARD? #youtubecreatorawards
00:41
Levsob
Рет қаралды 37 МЛН
1 класс vs 11 класс (неаккуратность)
01:00
БЕРТ
Рет қаралды 4,9 МЛН
100❤️
00:19
Nonomen ノノメン
Рет қаралды 38 МЛН
Why Neovim nerds are so obsessed with the terminal
6:44
Joshua Morony
Рет қаралды 72 М.
What the hell is a Tiling Window Manager? Linux For Newbs EP 2
12:33
How to use ChatGPT in the terminal
0:59
Zachary Proser
Рет қаралды 2,3 М.
vim Macros: Why and How-To!
6:30
Luke Smith
Рет қаралды 42 М.
Neovim Is a Waste Of Time, And I LOVE It | Prime Reacts
17:00
ThePrimeTime
Рет қаралды 83 М.
How to use your programming environment from ANY computer
14:23
zig is the future of programming. here's why.
9:34
Low Level Learning
Рет қаралды 187 М.
Tmux will SKYROCKET your productivity - here’s how
10:02
typecraft
Рет қаралды 64 М.
What is "New wave Programming"?
16:04
typecraft
Рет қаралды 24 М.
Latest Nokia Mobile Phone
0:42
Tech Official
Рет қаралды 491 М.
МОЖНО ЛИ заряжать AirPods в чехле 🧐😱🧐 #airpods #applewatch #dyson
0:22
Apple_calls РЕПЛИКА №1 В РФ
Рет қаралды 22 М.
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 23 МЛН
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 4,5 МЛН
как спасти усилитель?
0:35
KS Customs
Рет қаралды 517 М.