50+ Vim Tips and Tricks from Beginner to Expert

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
vim is one of the most used applications on linux and the vast majority of people know at least enough to open up them do their edits and get out of them but there's so much more to them than just you know that bare minimum there's so much more you can do and you you've probably seen youtube videos where vim experts have gone through and just done amazing things with them and doing edits in huge documents and substituting things and using macros and all this high-end wizardry and like wow i want to be able to do that and i'm one of those guys i want to be able to do that too but i look at where i am now with them compared to i was like where i was like a year ago and it's night and day so i think them is very much one of those programs where over time you learn more and more and you you just kind of look back and realize well i really know quite a bit about them even if i'm still not one of those people who can do all that magic in terms of editing and stuff so what i'm going to do today is give you 50 tips and tricks give or take a few i've counted them a couple times but it turns out i can't count that high but i'm pretty sure there are around 50. tips or tricks that will help you be a better vim user this is going to be quite a video and i'm going to go through them fairly quickly so let's go ahead and jump in but before i do hit that like and subscribe button if you haven't already i really do appreciate it everybody who's already subscribed to the channel i appreciate everybody we just got over 4 200 subscribers and you're all awesome so be awesome and hit the red subscribe button if you want to see more content like this so now let's go ahead and jump in i'm really really bad at those call outs that's why i don't do them very often but now matt the video is going to be like three hours long if you don't stop you know doing this all right anyways so the first one that i want to show you is something that happens outside of them there are many ways to open up a document there's the traditional way of them document name or whatever but let's say you wanted to open up a document to a certain line number let's say for whatever reason you're constantly making changes to the same file and you know which line number you have to change it's easy to open up them to that line number so if i do this do nvem config these are my dwm configs by the way and you'll notice that i can't actually type today i can do this and then do plus say line 34. so this is this should open up my config.h file to line 34. now it's possible that this doesn't work for me because if you have a setting in your vim config file that asks them to remember the position of the document after it's closed so that when you come back it opens up at the same spot what this will actually do is it will take that spot it was saved and add 34 lines to it so that sometimes happens to me this will only work for me if i'm at the top of the document when i've closed it the last time i'm pretty sure i did that so this should work and in this case it didn't work i was apparently at the bottom of the the line so that's the reason why it didn't work for me but for you as long as you don't have that particular setting that i happen to have this will actually should open up the file to line 34. it seems to be a little bit finicky with some settings that you have in the mrc file i should also note that i'm using nvem these tips or tricks should work just fine whether you're using vanilla them or neovim so the next one i want to talk about is cursor positioning so let's just say i wanna i'm looking at the screen and i wanna change the position of the cursor i can actually go through and change the line number if i want to by going to this thing or i can do uh something else like 10 j i can jump 10 lines if i wanted to but let's just say i wanted to move the position of the cursor on the screen i don't necessarily want to go to the top of the document but i want to go to the top of the screen i can do that by hitting capital h and that will take me to the top of the screen if i wanted to say say i'm at the top of the screen and i wanted to go to the middle of the screen i can hit capital m and that will take me to the middle of the screen so the next one i want to talk about is the letter d and the letter d does a ton of different stuff let me actually turn on screen key here so like i was saying the letter d just does a ton of stuff and as you can expect d pretty much stands for delete so if you're at the beginning of a line here and you want to delete the whole line dd will delete the whole line and that works for the same way you can do for a ton of other stuff so you don't have to be at the beginning of the line you can be in the middle of the line if you want let's just say we're down here and we want to do dd here that deletes the whole line it probably happened quicker than you can see but it deleted the whole line now let's just say you want to just delete this word dw deletes the word but it will only work if you're at the beginning of the word so if i'm at the in the middle it'll delete from the cursor to the right it won't delete the whole word so dw for for delete word will only go through and delete the whole word if you're at the beginning of the word otherwise it deletes from the cursor all the way to the end okay dl will stand for delete letter this will delete the c so whatever letter the cursor is on if you hit dl it'll just delete that letter okay so that's the letter d there are a few other things you can do with d as well if you want to say you want let's just say i want to delete three lines so i could do three dd and it will delete three lines i could do five dd five dd oops i can i have to actually you know do this right five dd and delete five lines now i can also do the same thing with words so i can do five dw and i'll delete five words so that's really cool and really powerful if you want to go through in your editing stuff and you want to you know do things really fast similarly c is also very important so let's just say i want to change this word here const underneath the cursor i could hit and get into the insert mode and you know delete it like that like a you know a complete noob or i can just do change word and it will delete the word and go and put me into insert mode and then i can change the new word to whatever you know if i wanted to do that so that's change word the other things for that work would delete will also work with change so if i wanted to change this letter i could do cl that will delete that letter and get me into insert mode so i can just change that one letter i can go through and do five change word and delete five words and put me to insert mode uh so i can do that as well another really cool thing i have some stuff here in parentheses so i have st here in parentheses if i wanted to change the stuff inside the parentheses the words inside the parentheses i can do change inside parentheses and i'll delete everything inside the parentheses this also works with so if i undo this and i can do if i go back to the beginning here here i can do change inside curly brackets braces or whatever hell you call them it'll delete every everything inside the curly brackets uh and that's really really useful that means you don't have to go through and you know delete everything manually so we just go through and undo that now i will cover undo here in a while but just needless to say use undo okay so that is the letter c and like i said change inside of stuff will pretty much work with anything we'll work with single quotes quotes parentheses brackets square braces all that stuff change inside and then press that key and it will be able to change inside those things now i do believe if i'm in the center here and i do change inside scroll brackets actually that does work i thought maybe it just did from the cursor but it actually does work just fine okay we're just getting started so strap in the the next thing i want to talk about is quitting and saving your documents so everybody knows colon wq and colonq that's the way them tutor teaches you how to do it and there's nothing wrong with using the vim tutor way it's perfectly legitimate to this day i still use that very often however there is another way to do it so let's say i want to get out of this document i don't really want to save it just in case some of those changes i made earlier you know mess things up so i can do capital z capital q and that will quit the document without saving now if i go back into this and i want to save it now i can do capital z z and that will save and exit so that is a really cool way of just getting out of a document whether you want to save it or not and it's easier at least one stroke easier than doing the colon wq thing okay the next one that i want to talk about is going to a specific line number so in this document here i have 195 lines and say i wanted to go to line 100 i can do that by doing colon 100 and hit enter that'll take me to the 100 line so that's really easy you can also jump a set number of lines by hitting uh something specific so let's say i want to jump 10 lines i can do 10 j and that'll take me down 10 lines let's say i wanted to go up five lines so we do 5k and that'll take me up five lines just on the same note this will also work in visual mode so if you're in visual mode so let's just say you're in this visual mode here and you want to jump down 10 lines you could do 10 j and they'll highlight 10 lines so you can use it in visual mode as well so the next one really only applies for your vim rc now this is part of my nvim configuration file it will look a little bit different than what your vmrc will look like but it's basically the same stuff it's the same syntax but let's say i wanted to know what the word imap means in terms of them i pretty much know what that means i'm mapping something for insert mode but let's say i didn't know that if i hit capital k they'll bring up the help page or the man page for them and it'll give me a little bit of information about what that means and you can do this for any key binding inside them it'll take you to the documentation for that specific command inside vim so that's really cool everyone knows that i is insert mode if you even if you just know the basics of them i is always insert mode but insert mode with the left lowercase i works in a certain way so if you hit i and you have the cursor here on the o in in in this particular document i hit i it's going to put the insert mode before the o before where the cursor just was it's always going to do that it's always going to work that way now let's say i wanted to put it after the o so if you just use i all the time like i seem to always constantly do i'd have to go into insert mode and then move the cursor you know manually like a like a a neanderthal what you can do instead is use lowercase a and that will take your cursor and put it after the cursor where the cursor was just a moment ago so that means you can just continue on from there capital versions of those letters do two different things so capital i will put you into insert mode at the beginning of the line you're on and capital a will put you into insert mode at the end of the line you're on so now let's go ahead through and talk about pasting and copying now copying and pasting in them is a little bit weird because it doesn't copy the stuff that you copy to your system clipboard unless you have it set up to do so i do have a set up to do so but not everybody does and i believe by default it doesn't work that way so when i'm talking about copying pasting or in this case yanking and pasting i'm really talking about words and stuff inside of them only it's not going to take that stuff and put it into a general system-wide clipboard for you to use i just wanted to put that out there so let's say i wanted to to yank this line and by yank i mean copy so if i just hit yy i've now copied that line and if i hit p i've now pasted that line exactly what was in the copy buffer so we can see this probably more explicitly if i do something that has something with some space around it if i yank this line here and go into insert mode and then paste this we can see now that's how it's pasted so i i did yy and it yanked the line and i did p and it pasted the line so if we do dd that will delete those extra lines okay so that is y y now similar to d and c yank will also do things with words and letters so if i just wanted to yank this word i could do yw and that will just yank that word if i just wanted to do just that letter i could do yl and then do p and it just did that letter so that's how yanking works and that's how pasting works the next one is a little bit more convoluted in expert mode we'll probably go back to some of the more beginner stuff later on but this stuff isn't really all that organized i probably should have organized a little bit better but this next one is like i said a little bit more expert mode let's say i wanted to replace the word static with something different throughout the entire document i can do that easily so i do colon percent sign s and basically what this tells vim is we're going to be doing a substitution okay and then we give the word that we want to substitute so in this case we want to do static and you can see i have it set up so it actually highlights static as i went along so then i do another slash and i give it the word that i want to replace it with so let's whatever okay and then i do another slash and i do g now g tell if if i just did it without the g that would just replace the line that i'm on okay if i do g it will do it for the whole document so if we do if we go back up here why i jump to the to the bottom by default it just does that you can see every word that was static now says whatever and we can just hit you to undo that because obviously dwm is not going to build like that but that's how you do a global search and replace in vim it's really quite easy and it's not something you'll probably remember you'll probably have to look it up if you're like me every single time but once you've done it a few times it should kind of get you in there so uh the next one is a tip for editing your vim rc file so let's just say i'm going to go to my nvem file so i'm going to cd into config and vim and then general and then i've them into general dot them okay and then we go back to the top here and let's just say i've gone through and made a whole bunch of edits to my vim rc file i've changed colors i've had some key bindings or whatever now if you're going to do this manually in order to get those changes to take effect you have to save your current buffer or your your current file and re-enter it you know like manually however if you have it set up a certain way you can go through and do colon source in my case i'd be do doing init dot vim which is my main neovim config file but for most people you what you want to do is do colon slash dot them rc now i would have to give the full length the full path to my init.vim but that was just an example you run that if i do config and vim init.vim i hit that and what that's going to do is reload live your vimrc file so that the changes you've made take effect without actually you having to go through and close it now the cool thing about this is that you can go through and set up a key binding so if i go through and into my key bindings uh folder here and then them into key bindings i have a key binding for exactly this so what this does is allows me to hit leader s so in my case the leader keys the spaces so i can do space s and then i'll go through and do the exact same thing i had to type out with so if you go through and are editing your vim rc a lot put this in your key bindings and that will allow you to go through and source your vim rc file without having to close it all the time just remember you're going to have to change this path so if you're using regular vim it's probably just going to be the mrc instead of what i have here now i have a plugin called nerd tree which allows me to open up a file manager that looks like this and it's really cool but you don't need that let's just say you don't want to have to add a whole bunch of extra plugins you can actually use vim's built-in file manager by going colon capital e small x and that'll actually go through and enter into a file picker for you so you can actually we can go up a level here and go to say general again and then general dot them and that will open up and that's how you can navigate through your file structure without closing them doing cd and all that kind of stuff you can just do it from a built-in file manager right inside them the next thing i should teach you is how to open up a file from within vim so let's say you've been editing this and you want to open up a different file you can do colon e small case e and then the path to the file you want to open and this can be a relative path so if you're in the same directory you can just type in whatever file you're in but if you're not in that you'll have to give an absolute pass so in this case we'll do config uh nvm init.then and that will go through and that will open up in a.m from where we were okay so the next one i want to talk about is one that is going to be life-changing for you probably if you don't know it and that is let's just say you you have a structure like mine and you're using neovim or even them because vim will allow you to create a vmrc like this as well and your stuff is all over the place it's in separate files and directories and all that kind of stuff and you don't want to have to go to a file manager but you have the path right in front of you for example right here i have this path if i wanted to go to this path normally i'd either have to open up the net tree or nerd tree i'd have to open up the ex file manager that i was doing or i'd have to close them and get there manually through the command command line or i can just hit this keybinding gf and that will take you to the file that you were highlighting so that is gf and it's really really cool i use it all the time it's so good now let's say you've want to switch two characters around this one's a really easy one let's say i'm making a comment here and i've mixed these two characters up so in c plus plus the comments are always slash star and then star slash but i mix these things up all the time so i might have done star slash and then you know did the comment and then did you know slash star and it's wrong because the mixed up so if i'm back here in normal mode if i wanted to get these right without actually having to edit them i can just do xp and it will actually switch them around now it doesn't work perfectly in this case because it actually adds a space actually it didn't work at all and i'm not sure so if we do xp again there we go that it worked then okay and then we can go here and do the same thing here xp and it will change it to the proper place so that's when you've made one minor mistake and you don't want to go through and delete things and all that stuff just use lowercase x lowercase p and it will switch those two characters around okay so let's say you've been in a buffer for a while now when i say buffer i'm basically just mean you're in a file it's more complicated that basically you can have multiple buffers open at the same time which means you have multiple files open at the same time that can be in a split you can be in a tab uh whatever so i use buffer and file basically interchangeably they're not exactly the same thing but just bear with me for that you know with that but let's say you've been messing around in a file for a long time and you kind of need to retrace your steps somewhere along the line you've made a mistake in the last few steps and you need to find that now you could just scroll up or scroll back down or wherever you've been you could do that manually or you could hit ctrl o if you hit ctrl o that will jump you back and forth between where you've been over a certain point now that will take you backwards in your history if you do control i that'll take you forward in your history and that's really cool so if you've made a mistake a a few minutes beforehand and you kind of remember where you were but not really you can just hit those keep one of those key bindings and it will take you backwards to where you've been in the document using your history okay at this point in the video which has been going on for a long time we're uh not even halfway through i probably should not have made this 50. probably should have done 25 but we're committed now folks let's just keep going we're going to keep chugging along at this point we're going to get into some really cool stuff so if you thought the stuff at the beginning of this was kind of basic but you kind of toughed it out and you're still with the video i thank you you are about to be rewarded because there's some good stuff coming so let's say you want to put the output of a command into your document without having to go to the command line and copy and paste and whatever let's just say you want to do that so let's go ahead and so let's go ahead and open up a new document here let's just say i wanted to go through and paste in the output of my zshrc file i could do that really easily by doing this so from normal mode what you want to do is do r oops excuse me you have to do colon r and then do exclamation point and then the command that you want to do in this case i want to use the cat command and then i want to do the path to the file so in this case my zsh file is in config zsh.zshrc okay and then if i hit enter what you're going to see is it's going to output the it's going to going to give me the output of the cat command of zs hrc basically what cat does is it reads that file and gives me the output of that file and in this case it pasted it directly into my brand new file that i just created and you can do this with anything you can do colon r exclamation point ls and this will give me the output of ls from the directory that i'm in outside of them in this case i'm in one of my nvem configuration files i think so if i go through oh i'm in my dwm file so this gives me the output of ls from that certain directory so that is really cool if you want to go through and edit or add the output of any command it works with ls it works with cat grep awk all that kind of stuff and they will take the output of those commands and put it into your file so there are a few cool things you can do with double exclamation points so from normal mode if you hit double exclamation points like this you'll see down here at the bottom it actually changes it to a colon period exclamation point don't worry about that you can always get to this by doing double bang bang as as we say it's double exclamation point and there are a few things you can do with this so the first thing if you do bang bang and then type in the word date what that will do is it will paste in the current date and time that's really cool uh you can also go through and run the current line in the shell so let's just say we have a a command here so in this case we're going to do ls tilde slash dot config slash gsh let's say i want to run that command now for whatever reason you have this in a script or whatever maybe you have a cd or you have a whatever command you're in that you have inside of a script and you want to run this without actually having to go through and run the whole script to see if it works maybe you just want to see what the output of it is you can actually run the whole thing the current line by doing bang bang and then sh and then enter and basically what that will do is it will will give you the output of that particular command and just replaces that command with output so in order to get everything that was in that file i'd have to do this and then then i can do bang bang bang sh and then enter and then it will give me everything that was in that directory it will run that exact command and it will work with anything so let's say you have a list of something so you have uh let's just say you have a list of numbers and you want to sort them in this case they're pretty much already sorted but let's go ahead and make let's let's let's make a mess so that they're not sorted okay let's say i want to sort these things i can do that by selecting them in visual mode so just hit v and then go down so they're all selected and then i can go through and do exclamation point sort and that will sort them a to z or you know ascending order i believe is maybe that's descending order i can never remember i i always get all that stuff backwards it always happens anyways uh so that's that's one way to sort you can do the whole document that way if you have them you know numbered or whatever or if you just have a certain amount of paragraphs that you want ordered by a to z you can do that let's say you're in a file and you want to rename it and no longer pleases you that this file is named text.txt i can go through and change that by going doing colon save and then the new name of the file so in this case i want to name it and i can actually go through and show you that this worked by doing an ls here and i now have a matte.txt here now it it actually just copies it to this it doesn't move it because text.txt is actually still there that's not exactly how i expected that to work but it basically the same thing uh it's weird that it does work that way but at least you've renamed it let's say we're in matt.txt and we want to open up text.txt in a split we can do that in two different ways now split does exactly what it says it's going to do it's going to split the screen into two different buffers so in this case we can do sp text dot txt xt and that will actually give us a split i didn't oh i know type the name right but it will give us a split of whatever file we opened up and we can just quit that by doing uh capital zq or we could wrote it as well if we wanted to by capital zz and we'll do this again with the actual name text.txt and we can now see that it opened it up in a this is a horizontal split now let's say that's not pleasing for me i want to do it in a vertical split so they're side by side instead i can do colon vs for vertical split and then text.txt as well and that puts them side by side now the problem here comes in is there's uh very weird default ways of switching between these i don't know what it is it's something about control w and then the vim keys i believe that's what it is i have it set up so i can just do contr do control roll h and ctrl j ctrl and ctrl l will actually switch between them sometimes uh anyways that did work if you see the cursor up there it moved back and forth okay but that you have to have that specifically set up in order for that to work so that's those are splits okay we're in the 30s we've made it through the 30s so let's say we wanted to let's go ahead and close one of these splits here and let's say we wanted to move matte.txt to a different directory we can do that by doing okay so i can do colon w and then the path to the document so in this case i'm going to colon slash matte.txt and then we can go to do that and now if we get out of this and go to our home directory and do an lsmat.txt should be here somewhere which it is right here so so that is renaming or moving of directory to a different directory moving a file to a different directory i should say okay the next one is a little bit about the global command so let's go ahead and vim into our matte dot txt file there and we have all this stuff here let's say i want to list all the contents with the word uh that so if i wanted to do that i do colon g for global and then type the word that and then do slash and it will actually go through and find all the lines that contain that and then highlight them that's not really all that powerful but what's great about this is if you wanted to do any lines that create that and uh input so we at least know there's one line that has the words that and input in it we can do that and then backslash and then type and then do input and then do forward slash and that will actually go through and highlight all the lines that have that one and there's only one right actually there is only that one line but you can see if you wanted to find all the the iterations of the line that have certain things in them so all the lines are a variable of a certain name for example you could use a the global command in order to search for those if you wanted to so this is global search in this instance you can also go through and do this convoluted thing that i'm about to show you now i can't tell you how or why this works just i'm going to put this out there i have no clue i i don't know very many people who can actually tell you how or why this works so we're going to use the global command again we're going to do a slash and then we're going to do a carrot and then we're going to do a backslash and then s and then a glob which is a asterisk and then the dollar sign and then we're going to do slash d now what this does is it removes all blank lines so if we do this it will take out every single blank line from the document and just delete them so if i had to guess it's what it's going to do is searching for all those blank lines and then that d at the end is deleting them so okay so let's say we've done a search here for config so we know config exists several times we've gone through and we've done some searching and we want to get rid of these highlights these highlights don't go away ever unless you tell them to go away so in order to tell them to go away you do colon and oh h and enter and they'll go away you can also map this in your vmrc file or your keybindings rc file if you want to do that as well so as you as you saw uh searching is done through the slash you can do slash config again and that will do the slash and hit enter and then you can navigate through these forward with the n key lowercase n and you can go backwards with the capital n let's just say though you wanted to search for two words so in this case we want to search for export and path so in this case we can do slash export and then the forward slash or maybe this is the black backslash yeah this is the backslash and then the plus symbol and then path if you can spell and this only actually appears twice so we can do next and next next next that's how you search for things that have a space in between them all right let's say you don't want to actually go have to go through and type in the search term you want to do so first let's clear this other search for noh okay and let's just say we want to search for the word path okay we can do that by hitting the star key so the asterisk key and that will just search for path throughout the entire document and you can go backwards with that same search by using the pound sign and i'll take it backwards in the document so if we clear you know we're using noh and then we search for the word user we can actually do the pound sign and that will take us backwards but it's only has one instance in this case anyway so if you had a whole bunch of those it would actually take you the other direction for that search term we're in the 40s we're in the 40s we got 10 more to go okay so let's just say we've gone through and made some edits here so they're let's say we wanted at the end of every one of these we wanted to do txt let's just say we want to do that so if we go down here and hit the period key it'll do the same thing now it's not great because we use little lowercase die so if we go here and hit lowercase a and.txt and then we go down here and do the period again it will do it better so we can go through and do this cool huh so it all that does is the period just redoes the last command on the line that you were on so that's just period that's all it does so let's just say you're a programmer you're doing some scripting and you have some parentheses here and let's put some stuff in the parentheses and then uh let's see we also have a couple curly brackets here we have some more stuff and we have some braces here and stuff like that now let's say we're back in normal mode and we're at the beginning of the line and we want to jump to the corresponding br close parenthesis we can do that by using the percent sign so if we hit percent sign it'll jump the cursor to the corresponding closed parentheses or bracket so if we're on this uh if i can actually get let's say i'm on this curly bracket here and i wanted to jump to the other one just hit percent sign it will jump us to the other curly bracket the next one is really easy i've been using it all throughout the video is undo so if i wanted to undo some of the stuff to you and that will undo a whole bunch of stuff if i wanted to redo that stuff ctrl r re-does all that stuff moving right along so okay so let's say we're going to make this a bash script after all this stuff this is the ugliest looking bash script i've ever seen there's not a single command in here that would actually run for bash well actually that's not true there is an if statement here that would actually work i forgot that i had the zshrc in here so that would actually work in batch so let's just say i wanted to put a shebang in here so if i wanted to go through and do that i could do colon let's see hash mark bang slash ben slash bash but i don't want to type that all out i can actually go through and have them auto complete that for me so from insert mode hit control n and then we'll actually go through and try to auto complete it for you so you can use bash so that's really cool now it doesn't work all the time and i'll only work with certain things and sometimes it gets a little bit iffy and whether or not you're in a certain directory or whatever but for the most part it will actually auto complete stuff so if you type if you're here bi you can go through and do control and again and it'll actually completely auto complete that for you there's no other option so if we do slash and then again it's not going to do anything because it needs a little bit to work with so if we do just ba again and do control n it'll actually go through and do that again so that's auto completion without without a plug-in so a lot of people install plug-in in order to get that kind of functionality them has that stuff about built in uh it's just not as good as some of the plugins so anyways that's really cool okay so the next one is a little bit about visual mode so there's two or three here so if you do uh some lowercase v oops we're gonna to actually get back into into normal mode if you do regular v this does this letter by letter as you can see i'm just highlighting this letter by letter then i can go through and yank it i can delete it using the d key and do whatever i want to do letter by letter if i hit capital v this selects it line by line now it looks exactly the same but as as we get to lines that are longer you can see this is selecting it line by line now there is another visual mode that is really cool so let's just say i wanted to delete the first lines of the next 10 lines here but i don't want to delete anything but that first letter so if i hit ctrl v that will actually allow me to select this by columns so i can go through and delete let's say i wanted to delete all these things you know i could do that so that is uh one that the control v selects by paragraph and it works well when you want to delete the first few uh columns of a line so say for example or the last few columns the line if they're all in line with each other you can go through and delete all the extensions of something for you know it would kind of the it would kind of work where up here we added a whole bunch of txt so if we could control v and go down here it's not going to do exactly because as you see they're not exactly lined up but if we hit d it will delete some of the dot txts uh it works better if they're all lined up they're all exactly the same so so that is visual mode in a nutshell so the last one also has to do with visual mode and there's four of them here so if i if you remember way back at the beginning of this video which it seems like this video has gone on forever which has we talked about how you could change things inside of other things so we talked about how if you have parentheses and you had a whole bunch of stuff here and then you did change inside parentheses you can do that but virtual mode also has something similar so let's just say you wanted to select the stuff inside the parentheses so you could do vi parentheses and it would select everything inside the parentheses it does the same thing with parentheses was that where i call those parentheses i meant uh quotes quote question marks good lord matt this video's gone on for too long so change inside quotation marks all that kind of and it works that it works with parentheses it works with both kinds of brackets it works with single quotes you can just go through so let's do a couple more examples so let's say we have a bracket here and we got some stuff here if we do vi brackets it will select everything inside the brackets if we have parentheses here and we got stuff inside the parenthesis we do v i parentheses it will select everything inside the parenthesis we can also go through and select a whole paragraph by doing something similar like this so if we uh go down here where we actually have some pair a paragraph and we do vip it'll actually it actually counts as all the paragraph but let's just say uh we have let's see here an actual paragraph with st with a space in between we go back up here and do v i p it will select the whole paragraph so holy snacks people that was one hell of a video uh the unedited time of this video is over an hour that is just blowing my mind i did not ex i wanted this to be under half an hour i don't know where it will be in terms of editing because there's a lot of stuff here that i can cut out but good lord i shouldn't i see when i was putting this stuff together when i was putting the stuff together i was shooting for a hundred tips and tricks i am so glad i stopped at 50. i would have been here for days wasting a wave out of thirst and everything so anyways that is it for this video if you stuck it all the way through first of all you're a trooper because i pretty much didn't stick it all the way through i almost did and i almost stopped so many times so thank you for for sticking all the way through if you if you did hit the subscribe button because there's more of this overly elongated nonsense on the channel that you can be happy with uh if you have just hours and hours of free time uh you can follow me on twitter at the linuxcast you can support me on patreon and patreon.com linuxcast make sure you check out the debbie and long-term review that i just did that was also a really long video but not nearly as long as this one it turns out you can definitely do that you can check that out on the page at youtube.com linuxcast uh before i go i'd like to take a moment to thank my current patrons devon chris east coast web gen two is fun too marcus miglin sven jackson knife and jewel joshua lee mitchell arts center merrick camp mr fox thanks everybody for watching i'll see you next time i need a vacation [Music] you
Info
Channel: The Linux Cast
Views: 46,335
Rating: undefined out of 5
Keywords: linux, open source, apps, vim tips, how to learn vim, how to get better at vim, nvim, neovim, tricks, tips, vim tricks, vi tips, vi tricks, become a master at vim, become a vim master, vim tutorial, best vim tutorial
Id: ZEIpdC_klDI
Channel Id: undefined
Length: 42min 37sec (2557 seconds)
Published: Wed Sep 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.