Vim Diesel's OFFICIAL Vimtutor Let's Play/Commentary! (1 HOUR+ Special)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I made that picture of Vim Diesel as my digital art project for school since i forgot about the project and the due was in a few minutes, so i made that really fast like a meme. Sent it to his email cuz why not, saying: Do you like my digital art project, my teacher gave me a C because she is a chromeos normie. Also wanted to say that I really enjoy your videos, and maybe you should make a full vim "tutorial" video.

Great to see so many enjoying and learning from that video. Now i use vim btw

👍︎︎ 21 👤︎︎ u/KenB0i 📅︎︎ Jul 01 2020 🗫︎ replies

Just want to say downvote and avoid this person like the plague.

I used to watch some of his Vim videos. But after checking out some of the channel I felt that his thumbnails and philosophy reminded me a lot about alt-right movement.

After more research I found that he had been participated in a podcast where they discussed politics and technology on a white supremacist site (think it was called neoreactionaries or something like that). They basically talked about how America has become degenerate and about the construction of a white ethnostate and all that nonsense.

No tutorial from his videos is worth giving his platform more publicity. I'm a bit disappointed that this has received as many upvotes as it has. He is basically a white supremacist. But I realize that most people probably don't know about this.

👍︎︎ 4 👤︎︎ u/xy32 📅︎︎ Jul 03 2020 🗫︎ replies

I'm guessing the bugman video pissed of a lot of redditors :P

👍︎︎ 13 👤︎︎ u/[deleted] 📅︎︎ Jul 01 2020 🗫︎ replies

Oh wow. I didn’t realize his channel dived into such things. I usually see his stuff as recommendations to any Linux/vim tutorials on my YouTube side bar so I’m not a regular follower of his less technical content. However, out of curiosity, I’m gonna have to go check some of it out.

Thanks for scaring your (very finely worded) thoughts.

👍︎︎ 13 👤︎︎ u/i_am_not_an_admin 📅︎︎ Jul 01 2020 🗫︎ replies

It seems like at least once a week there is a video where I'm like "Is this more about brand-building than Vim?"

One hour.

Vim tutor.

Let's play.

👍︎︎ 4 👤︎︎ u/SpecificMachine1 📅︎︎ Jul 02 2020 🗫︎ replies

This got posted here a couple weeks ago when the video first came out and it got heavily down voted. Do people here not like Luke Smith?

This is the same post from a month ago, zero upvotes

https://old.reddit.com/r/vim/comments/gssrtu/full_vimtutor_walkthrough_with_commentary/

👍︎︎ 9 👤︎︎ u/Alpra_Cream 📅︎︎ Jul 01 2020 🗫︎ replies

He's got great vim and linux content.

If he's walking in the woods, talking about the evil of roads, or the greatness of the unabomber... not so much.

👍︎︎ 3 👤︎︎ u/fuzzymidget 📅︎︎ Jul 02 2020 🗫︎ replies

This guy has a bunch of Vim and Vim related videos that got me into using Vim. Defo recommend his videos

👍︎︎ 3 👤︎︎ u/[deleted] 📅︎︎ Jul 02 2020 🗫︎ replies

Huh, happily surprised to see that people who disagree with Luke in this thread don't actually think that he's a white supremacist like the person who responded to my comment here!

👍︎︎ 1 👤︎︎ u/Kostas1507 📅︎︎ Jul 01 2020 🗫︎ replies
Captions
what's up guys vin diesel here today we're gonna do something a little different in fact i'm thinking about doing a vin or vim tutor let's play / commentary i'm just gonna go through vim tutor but importantly i'm gonna give you my commentary I'm going I'm returning to vim tutor after years and years cuz there are all these people who watch my channel I want to learn for them all unto them all you got to do is type in vim tutor in your command line but I think there are a lot of little things that I want to add to vim tutor so we're just gonna go through it I know you Zoomers love lits plays so that's what we're gonna do all right so I'm gonna start off just type in vim tutor in your command line and bring it up here alright min tutor VIMS very powerful editor blah blah blah stuff like that oh wait okay I gotta play stupid I got to play like I don't know what I'm doing in vim okay so we'll read now make sure that your caps lock key is not depressed and press the J key enough times to move the cursor to one point one all right so one point one what's one point one on it's on moving your cursor now vim of course Oishi I'll turn on the screen key so you can see what I'm pressing but um so vim hjkl they are your directions so k is up J is down L is right H is left so notably you can go through any of these lines notice that on lines where there's no content if I go here and press L obviously I'm not going there's no like words out there to go to so it doesn't unless you have white space so anywhere that's basic movement I know I you know a crit I cringe because I know in history there has been some gamer who has started to learn vim and he's like I should change these to be wast just so annoying alright so most important thing exiting vim this is alright the thing that annoys me most is SOI devs who don't know vim and like constantly brag about how they don't know it and how they can't exit it alright it's just such an annoying joke and frankly mostly these guys probably actually not to use vim but they're just being stupid I do it's just the noise thing anyway so the way they tell you is actually the dumb way to exit vim okay so they say first you've got to press escape to make sure you're a normal mode of course if you knew new to them you don't even know know what normal mode is but we press the scape and they say press : : q exclamation point and then press Enter alright so we're out that is the heart that's the most annoying way to quit vim alright that's a stupid way to quit vim how you oh yeah so control D is go down half a page control u is go up half a page you know D and you up and down but anyway so this is like the dumbest way to exit vim because it's way too many print I mean you've gotta press first off : that's hold down shift and press something Q is over there hold down shift and press no it's just stupid that's ways here's the real way to exit vim the real way to exit vim is hold down shift and press Capital Z Pat capital q you're out that's the real way to exit vim Capital Z capital Q that's it or now capital C capital Q is forced quit like exit and don't save any changes if you do make changes anyone to save them press capital Z capital Z that's the real way to exit them I don't know why people whenever I see someone using like : q to exit it's like that's that's way too hard I don't know it's so much more economic it might not sound that much more ergonomic but it's just like right you know you hit one hand it it's like no problem anyway that's how you actually actually exit them unless you want to do something like you know we'll say kill all them okay that's another alternative oh wait I guess that doesn't really work does it alright whatever who cares okay exiting vim so line number three or at lesson number one point three had to delete stuff so we're deleting stuff with X no one deletes stuff with X it's the most I don't know why they're telling you this but alright this is just practice to get you moving around so press X to delete the character under the cursor move the cursor to the line below marked okay wait alright yeah okay so to fix the characters move until the cursor is blah blah blah so we're just going to delete the characters we don't need I'm gonna do it the dumb way to get rid of that cow jumped over the moon man is so hard to use vim this way now of course if you're a newbie vim user you're like wow you got a press so many keys to delete stuff no this is like this is like the dumb way to use vim but you got to look you got to start somewhere you got to learn this so anyway Oh what did I just do so ZZ all right here's here's a vim lesson for you VIN noobs let's say you're on this line I if I press as easy see how I'm on the line that says press X to delete blah blah blah if I press lowercase T lowercase T don't hold down shift as you know that's exit but lower case e lower case e that puts that line in the middle or if yusei's lowercase Z and then T that puts it at the top or is it Z B for bottom yeah okay alright so that that's a pretty useful command I use is easy a lot I know I've never really thought that that's the same key as it is to like save and quit but I get I've never missed I mean you don't accidentally hit shift so it's not really problem all right so that's deletion press X to delete again you don't actually ever do that in vim you'll be using D and you know motions to delete stuff okay so press I to insert move the cursor to the first line below marked period to make the first little elbow ball alright so here's what we're gonna do we're going to go here we're gonna go to our period here we're gonna press I we're gonna say we were missing some here too we're gonna go here there is some text missing oops did it the dumb way didn't I from this line okay so the only things we really know how to do the vim tutors has taught us is hjkl alright to go into insert mode right and so insert mode just to be clear what's the difference between insert mode and normal mode well insert mode is just like normal typing as it is in any other kind of program right whereas normal mode is every single button in vim is a shortcut to something that's the magic of them maybe I should have said that before him but this is the most important point about them this whole thing normally see a normal I shouldn't even say that a Normie text-editor these are just like buttons that type stuff no in vim they're buttons that tux type stuff in insert mode but in normal mode they're actually every single one of them is a shortcut that does something special and unique that's the magical thing about vim it's like turning your computer it's like taking your keyboard and making it like a control console you have all these superpowers you just got to learn them alright so I to go into insert mode you type whatever you want when you're done typing stuff you press escape now first off this should be basic film stuff alright this is something you got to do when you start then pressing escape is hard it's way too far like when you're constantly typing stuff and then having to go to escape to go to normal mode no that's too hard so caps lock just map it look up how to map it on you know Linux or I don't know maybe some of you guys are using Mac but look up how to remap caps look earth switch escape and caps lock that's what you want because caps lock useless key in a great location change it to escape it's actually very useful even outside of them but in vim you're definitely gonna want to have it okay alright so basic stuff is easy again actually let's do ZT so lesson 1.5 appending I was gonna say okay here's something I should say you may notice if I press hjkl I'm moving really fast if you hold down K on your machine you're probably gonna be moving slower than me why is that well the reason that is let me show it to you I have a little script called remaps okay this this script runs when I start up my machine one of this and so you know I don't know what you're using what distribution you're using but just you can put this command in your as a startup script and it will change your life and it's this command right here okay it changes like the x rate it basically is the rate where you know if you hold down a key if it's gonna replicate pressing it over and over again because by default it's you know it's gonna be something actually oh maybe I could I don't know what that a fault is it's a 100 see if that changes I don't know if it actually oh no oh that seems even faster okay let me let's see X rate what oh wow now I can't even type all right go back oh go go back please all right no oh man okay yeah that was too fast I'm not even gonna experiment with that but just know this particular command X set our rate 350 that works perfectly for me it just speeds things up just a little bit so it's a little faster moving around now of course vim pros they'll be like I just like to interject for a moment you shouldn't be using hjkl to move around you should be using there are many other bonds to move around more effective effectively in vim I'll probably talk about those later but having this does not hurt I do recommend it and on you know if you have it it's easier to get around with more basic stuff like HJ and KML just you know to go ahead and tell you some other ways you can move around let's say curly brackets so if you hold shift and press the curly Brian Kerr Li brackets on at least American keyboards there you hold down shift and press the key with them but they move you see if I press you know left curly bracket it moves up by an entire paragraph it's like skipping between paragraphs that's one example of how to move around and I gave you the one earlier of control you and control D to move up half a page or whatever yes I know I'm throwing a lot of stuff at you but you know you can walk you can watch the video multiple times if you need I don't know I'm just sort of add living it okay so let's see let's add some more oh yes appending this is some good stuff so we learned that I puts you in insert mode and you can type stuff in okay also there's capital A and capital a it automatic it puts you in insert mode and it puts you in insert mode at the end of little the line notice specifically redoing stuff oh we haven't learned how to redo our undo stuff I shouldn't be doing that but even if you're at the beginning of the line here if you press capital a now you're at the end now you can type in the end of this line same thing here okay perfect so them tutor doesn't notice it so these are two ways to go into insert mode I and capital a but you can actually use capital I and lowercase a as well there there's actually a systematic change between them now no this is okay here's what I'm gonna do notice my cursor right now is on the T the first T in text if i press i right here and start typing that is going it that's inserting stuff to the left of that t okay now I'm gonna undo that change now let's say instead of pressing III press lowercase a that puts me in the insert mode but now I'm actually instead of on the left side of T I'm on the right side of T so if I type it's going to be inserting stuff on the right side of T that's the difference between so I is inserting on the left a lowercase I and lowercase a is inserting on the right side right that's the very subtle difference that'll come up but capital I and capital a are just extreme varieties so lowercase a inserts right to the right capital a goes all the way to the end of the line all the way to the rightmost side and then you insert stuff that's the logic behind it whereas what do you think capital I does well capital I puts you at the very beginning wherever you are and allows you to insert stuff okay so you inserted some text blah blah blah that's it alright so very useful comment so you now know four ways to go into insert mode there are probably other ones that I'm not immediate oh yeah there are lots of it like Oh we'll talk about some of those later okay so editing a file so use WQ to save and edit exit so you learned that you know : Q and especially : q exclamation point is exit right exclamation point just means force it don't you know confirm or don't you know I actually want you to do it but so if you add in a W here so if you say W Q that means save and quit I've never you use this because an equivalent of this I don't know if they actually say that this here but an equivalent of that is just using X and you can use it with an X nation put as well that saves and quits now in vim tutor it's not going to matter if you save and quit because you know it's not gonna it doesn't change your using a temporary file here so the changes I made in this are not persistent if I actually change it but anyway anyway so a pending editing a file okay yeah so you now know how to save saving in general if you just want to save when you're in vim that's just : W and that's it or you know exclamation point yeah if you want to force it but anyway and forcing is important let's say you're you're stupidly modifying a file in two places that might be a time to force save you really shouldn't do that or I think you can do it I don't even know but there's if it's like a read-only file or stuff it'll prompt you for that okay so lesson 1 summary we now know basic stuff about them and I've thrown in some important tips so you know hjkl okay you know how to quit that's just with Q you know how to save that is with W and Q or just saving alone and this is like : and then W blah blah blah just in case you don't know vim has many many commands you know : commands when you press : you're basically just going to the place where you can you know the insert any kind of arbitrary vim command just as an example it's here's an example of a command that I really I don't know here's an example I'm gonna highlight this entire document we haven't talked about that yet and I'm gonna say I'm gonna have press : to get into the command mode and I'm gonna say sort okay what did that do well it actually just sorted every single line in this file so now it's sorted every line alphabetically of course you don't really see that it's alphabetical because most of these lines don't start with stuff but you can see here right it is we've just highlighted everything and we ran a a vim command it happened to be sort that sorted everything other vim commands are Q to quit or W to write a file but anyone now let me find where we were you okay okey-dokey and you now know how to use I and capital a to go into insert mode I also talked about you know capital I which goes to begin to the beginning of the line and lowercase a which is just sort of goes to the right alright so lesson two deletion commands now of course using X to delete as they brought up totally useless no one ever okay I use it every once in a while but really you use D to delete now the magic of them here's where the magic of them is gonna start okay so maybe I'll read this press escape to make sure you're in normal mode use the cursor blah blah blah move the cursor to the beginning of a word blah blah blah okay there so now I'm on this line I'm gonna say there are it says there are some words fun that don't belong paper in this sentence so we're gonna go we're gonna go to the words that don't belong and they tell us to delete a word you say D and then W forward you you have to be at the very beginning of it so D and then W that don't belong paper in this sentence okay so now we have cleaned up the sentence now of course should have go into this now I don't know well I'll talk about it in a second okay so we've now learned how to delete a words now so X is just delete a character if you say D that's it's really sort of like a bin function D as of M function you tell it telling it I want you delete to delete something and the next thing you press is going to determine what you delete basically all right so more deletion commands all of these are gonna start with D it's really again it's just D and then you tell it what to delete so type D and then the dollar sign to delete all the way to the end of the line so here's our example sentence someone typed the end of this line twice end of this line twice so we go here to the part we want to start our deletion at and we say D and then dollar sign now Y dollar sign if you know regular expressions you know where this is going because dollar sign is a symbol of the end of the line in the same way that the little caret thing is a sign a sign of the beginning of the line now here's another motion command you don't have to say if you just want to move to a different part of the line you can actually just press a dollar sign to go to the end or you can press you know zero to go to the beginning of the lane actually you know I never really thought about it can you actually use the caret yeah you can't use the caret to go to the beginning of the line in vim the regular expressions in vim they sort of work together I guess there are people who don't know what regular expressions are but just play along if you don't so anyway so d dollar sign deletes all the way to the end of the line but that's a lot of key presses I've always thought that's a lot of key presses there's a secret there's a secret is the secret is you can actually just press capital D that does the exact same thing it's just like a little shortcut you can just press capital D that's nice it's nicer than pressing d shift and then dollar sign just a nice nice little secret best-kept secret of them many best-kept secrets of them okay so on operators and motions so I sort of alluded to this before when you press D it is that is the action you're gonna be doing and then the motion the key you type after D maybe it's DW for delete a word or delete D dollar sign delete all the way to the end of the line you have different things that you can press ok so they mention so let's see an example of them so we know DW let's try the W so I'm gonna delete the word start ok now that's gone we can also say de and de deletes the word it deletes to the end of the word and notice left over we actually have two spaces that's the difference between D and E or W and E is motions now I should be clear in the same way that you can let's say not deleting we're not talking about deleting at all again as I said you can just press the dollar sign to go to the end of the line or you know 0 to go to the beginning or dull you know caret to go to the beginning of whatever text you have additionally W and E are actually movement commands as well you can actually just instead of okay if we're just pressing L you gotta press it a million times to move out here you could just press W W actually moves word by word it's a little faster than now of course ours are super fast because you know we increased our ex rate so we can move quite a bit faster but you know either way double you can move words and he means move to the next end of you know the next word or whatever and I should say the opposite of D if you so that's move forward if you want to move back a word that's actually just B so if we press B you're moving backwards so hypothetically if I'm here on the word current I press D and if I press B what is that gonna do well it's gonna delete from where we are it's gonna delete backwards so it deletes the you know in this case it deleted the V before current okay that's what it does so the logic of them is vim has a lot of movement commands that you know move around for you and you can put something like D for delete in front of them and it will delete and like instead of moving you there it will actually delete everything that you know would be you'd be moving over in fact in the same way I mentioned you know the the curly brackets move up and down like through lines well what happens if I'm here I press D and then I press the curly bracket it actually just deleted that paragraph that's below it very nice okay all right so using a count for a motion oh here's another good one another classic all right so in this case we have so typing a number before emotion repeats it that many times move the cursor to the start of each line below marked blah blah blah with the arrow this is just a line with words you can move around in it so here we'll actually let's let's see type 2 W to move the cursor to words for it how are we supposed to do it from the very beginning wait yeah two billion okay type three e to move to the Curt move the cursor to the end of the third word for word so 3 B okay type 0 to move to the start along okay eccentric Center so the idea behind it asides just said the W moves you around you can also put in front of W you can put some kind of number that tells you how many times do it so let's say we're right here we want to move five words Ford very easy five W okay very nice yes so we we have our motions we're adding in numbers so what happens if we say d 5w d 5w what that does instead of moving forward five words it starts deleting from where you are to five words in the future okay that's what it does so the motion commands and the deletion commands again they're the same concept same thing and again if we want to say D for left bracket that's gonna delete the four you know bracket movements up upward so it's sort of like deleting four paragraphs kind of alright so blah blah blah using a count to delete more oh yeah that's just told you that okay so let's do this so they want us to delete stuff here so here we have some extra letters so we have two extra words we can say delete two words they're gone we'll move here we move there with the W command we just moved over to the next word now we have four words we want to delete we say delete four words you're literally like you're literally just speaking in English to them and it just does everything you don't have to like imagine being one of those guys who just like manually types everything out or like highlights it or something like that I can't even I don't know is like a totally different word world so here we have three more so d 3w okay there now we got it now everything's cleaned up so that's how you do it okie dokie operating on lines lesson two point six type DV to delete the whole line very very nice one okay so roses are red mud is fun violets are blue I have a car clocks tell time sugar is sweet and so are you so let's clean this one up mud is fun doesn't really belong let's get rid of that roses are red violets are blue I have a car notice I'm just pressing D D and D D works wherever you are in the line it doesn't have to be at the beginning it just means delete the whole thing clocks tell time that doesn't really make sense sugar is sweet and so are you roses are red violets are blue sugar is sweet and so are you excellent okay so now we've cleaned everything up and notice let's say we're here now I could DeeDee to delete this line I could also say for DeeDee and that just deleted all four of those lines that's interesting okay so next is the undo command now I'm going to tell you before we'll talk about that in a second but I want to show you well actually I've been using the undo command anyway right so if I delete you know for DeeDee all these lines if I prêt to undo something you just press you undoes stuff that's it that's all you have to know or to redo stuff you press ctrl R all right they're gonna talk about that in a second but here's what I want here's an additional thing so we learned that DW is delete a word right okay but here's the thing sometime if you're in the middle of a word if you press DW look at what it did it didn't delete you know we were in the middle of roses and I said delete word okay it did it didn't delete the word it deleted from where we were to the next word but it didn't delete I wanted to delete the word that's like the normal way to do it right now the fact of the matter is whenever you have a motion well there are additional little modifiers you can put onto your motions here or your text objects I don't know the official terms but here's the idea behind it so you type D I'll just do it and I'll show you how it works you type D a W that deletes a word and a means around it's like the word and any white space around it okay so da W deletes that word in the space the trailing space or whatever you can also do D iw and that deletes just the word I is sort of for inside it Julie deletes just the word and not the white space around it so this might seem like an arbitrary you know da w di w now the good thing about that is you can actually you know you you can do it from anywhere in the world word but also you can do you can it has different text objects aside from word so let's say I'm right here on move and I decide I don't like this entire paragraph well you could use W to delete a word but it ends up P is a text object for the entire paragraph I can do this d delete around P for paragraph and it's gone the whole paragraphs going da P it's gone da p da p v da P you know it's it just works you know so that those are well okay the real reason these are useful is this okay let's say I have stuff okay let's say I have stuff in up some parentheses okay I don't know if they actually bring this that they probably bring this up later in vim tutor I don't know if they do but either way let's say we're in these parentheses and I want to delete all this stuff in the parenthesis okay look see there five words I could go to the very beginning I could say delete five words that's correct you could do that but parentheses are also text objects in vim so anywhere in here I can say D for delete I for inside and just parentheses and it deletes everything in the parentheses wow it's like it's like magic or so that's di parentheses but if ya di parentheses if you press da for around parentheses that deletes everything including the parentheses it's magic it's like magic so that's how you do text objects in vim I don't know maybe vim tutor talks about that later I forget I don't really remember like all the stuff they do so press you to undo the last commands capital you to fix a whole line so let's go here fix the arrows on this line and replace them with undo okay I think that's all of it so we can either undo them manually or we can just press capital u and undo them all and did they say oh yes and ctrl R so you is undo ctrl R is redo you know thing that you undid there are also here's some crazy things about them that okay I always forget this Iowa you can type in so you know we remember colons or where you type in vim commands like for example which ones have we learned we learned a sort that's a pretty sweet one I guess there's a okay yeah this line moved up here but all the other ones are sorted by number so another vim command is what is it earlier I want to say is it earlier I think okay let's say earlier five M okay what happened here okay we're back here at the Roses a red thing earlier what earlier does is it jumps back five minutes in your history that's what it does it's like Oh what I mean so if you messed something up ten minutes ago you can literally just hype earlier ten minutes wait earlier ten minutes and it will go back ten minutes so now we're here back where we were ten minutes ago or I suppose okay what's the opposite of earlier is it later I don't quite know so let's go forward yes it's later okay now we're back where we were we literally just time-traveled in vim you you wouldn't even think this is this is this old text editor you it can't on travel okay alright look let's see or whatever you're using do that I'm sure a lot of I des can do that nowadays I assume you never know but okay so listen to summary DW d dollar sign blah blah blah you will know all these the important thing is there are special commands for remote you know motions for moving around like W is move you know word at a time be is word you know move backwards by a word you know e is sort of like W but it moves to the ends of lines you know we talked we talked about brackets and the important thing is if you want to delete stuff you can just put D right before that and it will delete you know whatever you know let's say we want to go here we want to delete you know delete three words delete three words BAM okay additionally I told you you can also use a or I for our round or inside a text object so delete around a paragraph will delete an entire paragraph in the white space around it or di P will the entire paragraph it'll leave the trailing whitespace see we're still on a blank line here which would not happen if we did da P now that that might see the difference between da p and di p might seem a little obscure but when you get good at it you'll be like oh okay I'll use this here and it just it's just like magic but definitely you should keep in mind using parentheses and stuff like that you know di parentheses that'll delete all the stuff in parentheses and also it works with quotes and stuff like that in fact with quotes it works even better because you don't act or I think it does you don't even have to be in the quotes I can say di quote and it actually moved to the next quote and deleted everything in it very interesting although it can be a little wonky if you have a line that has a whole bunch of quotes in it so you should always try and beware you know actually where the quotes you will want to delete are but alright and we also learned how to undo and redo stuff okay lesson three the put command let's see how long we can do this I'm getting a little time get a little sweaty the thing is for my videos I always turn off my AC because it makes noise but I don't know I'm getting a little sweaty now you know just so and we're going so intense Vin Diesel guys Vin Diesel speedrun actually this is not a very good speedrun it's a let's play but whatever okay the put command so P means put if you just type it alone obviously it's a text object if you press D or some da before it P is a text object but if you just type P by itself it means put or you can think of it as paste because that's really what it does here's the idea behind it they give us some lines here so this is supposed to be a roses a red poem and it has a is at the bottom B is the second one here C is right here and D is at the top we got a reorder to this stuff so here's how it works hey I can go here delete a line DD remember that one and I can go up here to where I want it to be and I can press P to put it in or paste it in if you want to think of pasting or I can go here DD delete that one move it down here press P to paste perfect it just works so that's that's how you that's basically how you copy and paste in vim now I should say copying and pasting invent because I know this is gonna confuse some people right off the bat this is vim internal copying and pasting it doesn't have to do with your system clipboard that is if I if I you know delete that or whatever and then move to try and paste it into Firefox that's not gonna work vim has its own internal registers for copying and pasting things and this is actually a lot better for different reasons you can actually vim actually has as many plate-like every key okay basically you can store things in particular keys and then print them out from you know the the buffer or register or whatever they call it it's very useful but right out out of the bat vim does not have the ability to copy and paste using your system clipboard now or at least vanilla vim if you use G vim or I actually use a neo vim niobium is basically literally exactly the same as vim except for it has you know and how you can set it up to have maybe I should actually just talk about how to do that because people are gonna get confused i'm annie ovum and in order to allow it to use the system clipboard you just got to put this line in i'm pretty sure there might be another yeah i think that's it you just set clipboard plus equals unnamed plus or these at least in linux you should probably look it up don't take my word on it right here just look it up online if you want them to use the system clipboard i think i'll i you know i originally was skeptical of the idea because it's sort of a vim elitist thing to be like oh we don't need the system clipboard we'll do our own thing but it actually does sort of work out for different things so just know it's it it's an easy thing to change just either install g vim or what is it vim there's some other vim plugin that adds it in but anyway i did a video on that a long time ago but I just use neo vim because you can just add in the feature itself alright so the replace command type R X to replace a character with X so replaced by itself is actually not super useful well well we'll just do it so here we're on this if we want to replace this a with the e we just type r e something like that here or we'll replace that will replace oops and place that with the wrong thing okay etc etc another thing you can do all you haven't learned visual mode yet but you can actually replace like you know long sequences of things if you highlight them in a replace but bar by itself I don't really find that useful I don't really use it that much I don't want to say that I let me think let me think of it useful for it but I definitely use that I will say that like every one small will come up but that's not usually the way usually you use the you know see for actually they're gonna tell you what that is alright this is how you actually replace things okay you you see okay so everything you just learned about D like D D to the lead-lined D dollar sign to delete all the way to the end of a line D 3w to delete three words all of those apply but with C and what does C do C delete stuff and then puts you in insert mode automatically what do I mean by that so here's an example I would you know I guess I could use vim tutor but you know I'm just gonna do my own thing here's an example here I got um so we already know that if I'm in these parentheses I can press di parentheses and that deletes everything in the parentheses after that based on the stuff you already know you know that you could go into insert mode and keep typing right now see is like it's sort of like both of those motions in one it delete stuff and then put you in insert mode automatically so if I if I'm anywhere in these parentheses I press C I parentheses I can just start typing okay or let's do the things that they want us to do okay let's go down here so this line they totally misspelled this so if we want to just replace this one word we press C W line we can go over here to words okay again CW need is drastically misspelled I don't even know how you misspell that well I guess they yeah I guess they shifted over one one key or whatever so need CW typing in press escape when you're done and then we'll go here using the change operator okay so all the stuff you learned about them or learned about D in vim is true of C its f-4c just puts you in insert mode at the at the end of it and of course even you know so I mention capital D is delete to the end of the line capital C same thing except for now you're in insert mode that's it and you might say oh well there's an entire different button just to like add a single key press just the like optimize pressing one key and yes that's how vim works like you want everything you'll be changing stuff a whole lot when you're editing files so it's really great to be able to um you know just save you one key press because you'll be using this a whole lot all right more changes using C blah blah blah they just said the same stuff that I I was going to let's see the end of this line that's okay I guess they want us to start here so we can do see dollar sign to change into the end of the line but I'm just gonna use capital C same thing as capital D but you know IG be corrected using the C dollar sign come in well they have an extra space there or something whatever man who cares 101 I saved all right so summary okay ptoo paste so let's say I well that's another example let's say I delete around paragraph I've now deleted that entire paragraph I can move somewhere else that's deleted of course but if I press P BAM it reappears it reappears where my cursor is so I can move anything I want around I want to move this around I'm gonna mess up all vim tutor okay that's that's what I'm doing I don't think I've ever seen in Denton tutor so brutalized I haven't used this thing a long time you know I've actually guided a couple people in real life through BEM tutor like sort of I mean it's sort of like it literally is like teaching someone a new video game or something you know alright so cursor location and file status maybe I should break this up into multiple videos but I keep doing it so I don't know I'm not too tired yet maybe I'll maybe I'll break it up I don't know all right cursor location and file status so type control G to show your location in the file and file status so you'll see down here it says line 487 of 962 and also 50% okay we're 50% through the file that's what that means so here's what you can do in vim if let's say I want to go to 20 I want to go to 1/4 through the file that is like to the 1/4 of the way through the file that is 25% guess what you do here's what you do to 5% now you're there now we can actually press ctrl-g and confirm oh we are 25% through or let's say well duh 75% okay or let's say a hundred percent now of course you would never actually type 100 percent because yes because there is capital G if you press capital G at any point in time it goes to the bottom of the file you're in or if you type lowercase G twice G G it goes to the very top okay so that's that's how you get around yeah I'll use capital G and lowercase G G over and over again and of course if you don't want to use those who can always use percentage signs to get fine-grained control over where you're gonna go 90 % 33% whatever okay so that's that and as they said control G shows you where you are all right in the search command yeah this has been sort of a long time to get all the way to the search command but it is an important thing basically slashes search so if you press slash notice that in the bottom of your screen you have a little thing where you can type and let's search for lull doesn't appear pattern on family ok search for vim ok vim exists so it found this instance of vim here if you want to go to the next instance you press in in in in in or capital n goes backwards previous instance let's go back to approximately where we were okie-dokie search command alright that's pretty much it for them alright I'm bored with the stuff they're talking about now here's some other things that are a little bit useful about them cuz oh actually they're gonna talk about the parentheses that's good but here's another little thing what for example does o do we're learning we're learning more about these buttons at all what does o do oh is a very useful command let's say it really is start a new paragraph like let's say and we're at the end of a line o means start a new paragraph and put me in insert mode ok that might sound like a totally arbitrary like what again that's one of those weird key combinations because you could at any point say let's see how would you do it go to the next line and then enter insert mode and then you know make an extra line and then go into you know you could do that but oh just sort of saves you a couple key presses you'll be using Oh a lot now capital o does the same thing but reverse if you if you're at the top of the paragraph and you want to start before that add in another paragraph or something like that that's what capital o does so that's another little tiny tip alright so matching parentheses search blah blah blah oh ok this this is a sort of interesting one I don't really use this that often but it's an interesting one basically here's how it works you can go to any let's say you have a parentheses you know hopefully it has a a buddy on the other side of matching parentheses and if you're if you have one of those parentheses highlighted if your cursor is on them you can actually just press % and it will jump to the other one of them of those or if I'm on this parentheses I press % notice I go back to that original parentheses and it works for brackets and it works for I wonder if it works for quotes I've never thought about that see quotes are harder to do because you don't like I don't know no it doesn't work with quotes dang oh well but so this is something I don't use this as much Oh like I feel like it is theoretically useful I can't think of a time when I've used it especially because if you're doing stuff like let's use what we learned before change in parentheses you know that takes place of a lot of the times you might need to do that but I think they say there I think they say here yeah this is very useful in debugging a program with unmatched parentheses because you know if you have a really big you know let's say you have long lines of lines like a block of code and some parentheses is somewhere and you're looking for it you can always use this to check if there's a match okie-dokie so now we're gonna get into more who substitute commands now I remember when I first took vim tutor I first used it I remember learning substitute and it just went out the other ear because I was like oh let I Tom that's confusing man like I don't want to have to remember that but that was before I knew regular expression this is basically like a said like a said replace command that's basically what it is so as I said we know some you know we know some vim commands we know quit we know sort stuff like that we're gonna the S command which I guess is sort for short for substitute basically replaces one of all let's just do what they tell us to do all right let's be good boys okay your due date okay yeah we'll start here so to use the replace command you press call you go you know press colon to run a command we're running the s command then you put a slash and you say what I want to replace and in this line the word thee is spelled with two E's so I want to replace that you know V with two E's what do I want to replace it with I press slash and say the and then you press slash again now if you just ran it like this it will only modify one of the instances the important thing you gotta do is press G at the very end and that replaces all the instances now this might seem a little obscure but if you you know watch this channel if you you said if you use a lot of command line options and stuff like that this is exactly the same syntax as said it's just really the substitute command the thing you were placed with the thing you replace it with and then some options G is you know the most common one if you don't run G it will only replace one match on the line you're looking at if you are put or if you do run gia or will replace all of them now additionally they note you also have some other options here so if you put parentheses at the beginning of your substitute command it will change every occurrence in the whole file and yeah so it's it's pretty convenient to add that stuff in I think I actually in my them RC because this is sorta I will admit this is sort of a pain to type out because often you you know you're in a file and you want to replace you want to rename a variable or something like that so you want to use one of these commands but it's sort of a pain to type out in my vim I or my you know neo vim or whatever I actually just have it bound let me show you so the the the the okay I actually just have it bound to like capital S if I just type capital S it actually writes the syntax for me and I can say replace the with more okay so it replaces all of those instances but you you'll have to look in that how to do that in your vim RC to figure that out well here is to just show you I don't know it's a vim tutorial map s yeah it's basically this so this means remap and this is your so your vim RC it's where you edit you add in vim commands or vim settings stuff like that I just remap capital S to be this sequence of key presses so I type out the syntax for it and I press left left to go back so I can start typing in the in the little brackets alright so lesson for summary all right how how much stuff how many lessons are there maybe I should check out I don't know I I noticed that I'm getting a little sweaty here again no AC it's such a pain so ctrl G you learned about that importantly GG to go to the top capital G to go to the bottom also oh if you press a parenthesis or if you press quotes or whatever let's say I'm here I go to you know 25 percent I can actually press quote quote to go back where I was a second ago that's just always what that does or well anyway we said let's see what we were talking about we were talking about this stuff right okay all right so slash is search I didn't mention it I mean they did but question mark is search as well except for by default it searches backwards and remember when you know if you're using the default search that's just slash you will be you know it'll find the next match press in to go to the next next match and capital in to go back question mark is just that reversed you're looking upwards in will go further up capital in will go further down I was getting confused by question mark well are not confused but I just find it a little unnecessary since you can well I mean I guess if you're looking for only one thing that's only up any one and then you have these substitute commands okey dokey so how to execute an external command now this might be useful for those of you who you know already know shell scripting I will go ahead and say when I learned vim I didn't know nothing about the Linux or you know typing things on the command line it was actually wait this is weird to say but I actually learned them on Windows that I know that's a weird thing I know a lot of people runs on Windows I know that in fact but I mean it does and that's where I originally learned it so many way so : plus exclamation point that's actually the universal sign of run a shell command or something like that so I can do this I can type LM doing one yeah I can type LS it'll show you all of the stuff that's you know it'll it's like running LS in your actual terminal it'll show you the contents stuff like that so that's that blah blah blah you don't think they tell you anything else more on writing to files blah blah blah blah I'm a little bored oh all right here's some good stuff all right selecting text this is important now I've done this actually a couple times in this video basically so we've learned about two different modes there is you know insert mode you can go there by pressing I or a or C plus a combination of motions and you can insert stuff and of course normal mode again normal mode is when you have all of your key your precious keys are all shortcuts to make you I don't know Captain Kirk in his little command line or command line count console V is visual selection so V if I press V I can just move around and that will select stuff I can use any of the motions that I'm familiar with you know we brackets or something like that or control D or something like that and it will move around and it will visually select everything in fact you can use it with something like you know we talked about da p2 delete all of whole paragraph da P undo that you can also type in V AP and that will actually you know visually select the entire paragraph that can be useful I mean you can continue to change the visual selection or something like that I have taught you about yanking and copying and stuff I don't maybe they have it anyway well I guess I'll tell you about that now so you can well maybe you don't actually need to visually selecting any stuff but you sometimes it's helpful so di p2 the delete all a paragraph why ap Yanks the whole paragraph meaning it basically copied it okay so I can go somewhere else and I can paste it in right sort of weird pasting it in itself but you can go and paste anything in with P okay but you can also if you have visual selection you know let's say you have something visually selected you could also just press Y to select that in addition to lowercase P there's also capital v capital V so lowercase V to be clear let's say I'm in the middle of this line lowercase B you know you just sort of manually move to the stuff in the line you want to select capital V selects everything by you know line by line okay so if you have any part of a line you have all of it okay so it's gonna select everything like that and there's also control V control control V actually moves like this so it doesn't move with the stream of text so to be clear actually if I use normal V you know I don't have a block selection you might want but you know control-v that's what control-v does you sort of get a block selection and you know let's say I decide I don't like this text detail D to delete it's all gone all right okie dokie retrieving and merging files bah-bah-bah they're just gonna have you do boring stuff the vim tutor sort of gets boring as it goes on yeah retrieves this phone I've gone blah blah open command oh yeah I guess they do tell you about oh you know open up a new line okey-dokey let me see if there's anything else I feel Oh a pinned this is wait no no no no no this somebody thought I thought it was period are you here's another cool command period most important command I don't think this is actually in vim tutor here's what it is let's say i okay here's an example real life example let's say I have some stuff in this some parentheses okay then I have some more stuff there's some more parentheses okay then there's some more stuff and then you know more parentheses and there's more stuff in that notice everything in the parentheses right they're all different there are different numbers of words and stuff like that so let's say I want to go and replace everything inside of these parentheses with you know somebody's name or some variable name okay so we already know if you remember see is change and if you want to change the things inside of a parentheses parentheses pair of parentheses you say change and then I for in and then parentheses so see my parentheses now you can type whatever let's say we'll call this Billy okay now the thing in the parentheses it's Billy so here's the cool thing now let's go to this other parentheses okay hypothetically you're you're there and you want to do the same thing now what would you do you you would type C I and then parentheses and you would retype Billy right no you wouldn't do that here's what you do you press period that's all you got to do you just type period and then what period does is it redoes redoes the last command you did so I can go over here press period again BAM Billy here's another example okay here is some text okay I'm actually gonna so maybe I should explain I don't did they not talk about yanking maybe I just skipped over that but you know so didi delete a whole line to yank a whole line why why okay so now we have yanked this so I'm going to paste it a couple times you know maybe I'll say five and paste that or maybe well anyway that I don't want to complicate it so another thing you could do is let's say we're on this first line and we want to add some text to the end of all of these lines there are actually multiple ways to do I mean there are a million ways to do everything in vim all of them more efficient than the others but here's an example let's say the first one you know I go here and I was like I need to add some more to each line okay so I press capital a to go to the end of the line and insert and then I type the stuff I wanted press the scape now I'm back in normal mode now you might think if I want to add that to every other line here I would have to do that manually and blah blah blah note you just type dollar period period period period or actually you know what let's do it even more efficient than this another vim command that's very useful is the normal command so let's say I have all of this stuff highlighted I'm gonna press colon to go into command mode and I'm gonna say norm norm is a fantastic command what it does is it says I'm gonna run the sequence you gave me in normal mode on all of these lines so I'm just gonna press period and it just did all of that for me wow that's magical it's this this kind of stuff is it's fantastic when you're doing it in real life you'll be like especially norm I love it as a command you can do all these crazy things you just got to keep it in mind right but you know if you forget norm again you can do them manually or did they teach macros here maybe I should talk about macros I don't know but anyway let's let's not complicate it more well I'll just just for evenness sake norm BAM all right another way to replace okay this is a good good thing to do so type capital are to replace more than one character so I said that the regular are you know if you're manually replacing something with our it's very inefficient because you got to do what one character at a time it's like deleting stuff with X no one actually does it but capital R puts you in replace mode where basically you just overwrite the text that's already there okay so here's the example they give us they have X X X and they want us to replace it place it with four five six now as you already know you could do CW right CW or you know even if you're in the middle of its eiw right and then you could type you know that stuff and blah blah blah but you could also use R and R you just press their capital R to be clear and I just type four five notice they're overriding the X's six that's it okay press escape when we're done that's a replace mode or I can go here replace mode five seven nine now replace mode is actually four totally different use cases than change because here's why let's say I'm here I want to replace gives with I don't know bestows or something like that let's say I type capital R best those oh look at that it actually over I did the text that follows after it so capital R is only used for replacing something of like the exact same number of stuff now this is still useful it's still replica you know you can still press dot to redo it and so I'm pretty sure you can yeah but I think in ninety nine percent of the time or at least 95 percent of the time you want to see W or CAW CI w so fist those okay you know vim does actually I thought for a second is that spelled right in the stove that's not a word you use that often vim does in fact have a spell checker actually maybe I should bring that up spell okay I always have to I have it bound to a particular key binding in my vim but you can do this you can say set local shoot I might actually have to download a dick the dictionary for that spell lang equals in u.s. okay yeah okay so notice what happens is escape here became highlighted that's because I have my spell checker on so spell blah blah blah well that's not spelled or spell is not spelled wrong but it will also highlight stuff that's like um you know not capitalized or stuff like this so this is you can see that this word is not a word you can go to it and you can you know you oops you can press well maybe I'll get a word that's closer to being a real word let's say Apple okay suffer with only one P you can press Z and then equal sign and it will actually give you a list of words that this thing could be Wow look at vim um look at this minimalist text editor that or at least it looks minimalist it actually has literally every feature in the world blow but you you can type which word you actually want it to be and bam so let's say I actually did forget how to spell bestows okay it would oh look that's highlighted so I'll say Z equal and oh there there's the correct spelling or and maybe we'll we'll say bestows why not okay so that's how you do it and also if you have multiple misspelled words okay you can go from misspelled word to miss bol spelled word using bracket s okay so we're jumping forward two different words now look at look at my words there so the colors are so bad I need to change that I think that's in my own configuration okay so oh yes now we're talking about copying come on our I've been bleeding for this this this vim let's play has been I don't know twists and turns for me I always forget what's where so use Y to copy text and P to paste it so you know all the stuff you can delete or change with C or D you can use Y on so again YY is copy a whole line you can paste it in how many times you want let's say I'm here I want to copy just two words so I can say yank two words and then I can go here visual mode visual mode visual visual mode over and over and over again that's how you you do it or even here of course yank inside parentheses that will copy out paste and pasting it inside of it's inside of itself or I can say yank around parentheses and kids what is that gonna do that's right it's gonna copy the parentheses to all right so we're gonna paste those in as well I don't know why I topped it oh there oh I guess it was pressed Oh twice alright set option just this just learned learns you about and how do you like it set label spill Hey oops turn off that spell channel okay alright so the set option is just sets variable sets variables so one example that you might want to use is I see so here's an example let's say right here we have the I don't know why I'm pointing to it like you can see what you know what I'm putting up but let's say we have the word search here okay and we want to look for that word search well I'm gonna press you know slash and I'm gonna type in search okay oh it didn't work it found this search and I found this search but it didn't find this one because it is not case-insensitive by default but you can set the command set I see okay and now if we we search for it ah it shows up because searching is now case insensitive you can also set as they say HL search say set HL search and that will highlight whatever you're searching for so the so all of these things now you might say oh that's all this stuff is hard to remember all these variables I don't want to have to remember that you don't have to remember that because what happens is when you you know as I mentioned if you want for example the ability to copy and paste from your clipboard well you've got to use neo vim or something like that but you can just put this line in your vim config file the same thing if you like for example highlighted searches you can just put set you know I could just put in set HL search in my VM RC and whenever I open vim that command will already it will automatically have run so it's very very nice I actually really hate highlighted search so I'm gonna turn this off so what is it no HL search I'm man I really hate highlighted searches it's so annoying okay so we talked about oh I had talked about it earlier we talked about a all the stuff we've talked about bla bla bla and variables getting help you put comments in the video description I don't know anyway vim has actually a help menu if you type in help and then you say well learn about vim pains or something like that oh look it pulled up information about pains or something or is this actually better yeah whatever no this is just the help so anyway I know you have to actually search let's see who knows I don't actually use help okay creating a startup scripts that is actually vim that's of MRC that's what I was talking about just a second ago so just to be clear you know maybe I should say what an RC file is is it like at the end of this video and sure I'll talk about that but anyway the idea in case you don't know in case you're totally new here and you just you just watched like I don't know how long I've been recording this but all this vim stuff just in case you don't know files like them usually have something you know called an RC file okay usually you keep your VAR c in your home directory it's dot VM RC and you can open it up and you can put all your favorite settings set HL search you know stuff like that you can put all the settings you want that I just talked about a second ago in there okay now - not in vim RC because as I mentioned a second ago I use neo vim it's in a slightly it is in where is it it's in config slash neo vents slash in vim slash in it vim but anyway that's not important okay command line completion with yeah you know how to tap complete right guys okay so you can do stuff like no HL and then type tab basic command line thing works in vim works everywhere else I think I think we're about done I think that's about it that's our let's play a ving tutor so this is I'm glad I'm vim diesel I've been your guide through vim tutor hopefully you made it through you probably missed a lot so do it over and over again that there's no shame in that I did vim vim tutor multiple times when I started I've helped other people through them tutor multiple times I went through this very fast sorry if I went a little fast if this is like your first time so just do it on your own pace where you watch the video if you want have fun I've said this in other videos there are a lot of things I do want to channel that are you know maybe a little niche and I've found a lot of enjoyment from and you can optimize a lot of stuff with but a lot of them aren't for everyone I will say vim is one of those things that should be for everyone like everyone who knows you know who is doing anything on a computer should learn how to use them what we've talked about now hopefully we've learned some cool stuff right but what we've talked about now is just the tip of the iceberg vim is so powerful despite being this little tiny program that's installed on every single server you know if you really get to learn to use vim you will never be like oh I wish I had this IDE on my you know server or something like that it is so powerful you can get so much out of it and it happens pretty quick so you do you you do your thing this probably been the longest video I've done a long time I just had nothing to do this afternoon so I'll see you guys next time enjoy it enjoy them have fun redo it learn something yep
Info
Channel: Luke Smith
Views: 139,623
Rating: 4.9616756 out of 5
Keywords: vim, neovim, vi, tutorial, instructions, learn, learning, exit, ide, emacs, nano
Id: d8XtNXutVto
Channel Id: undefined
Length: 67min 19sec (4039 seconds)
Published: Fri May 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.