8. Introduction to .vimrc file in vim

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I mostly guys and welcome to the eighth and probably the last video now I dropped into them tutorial series and in this video we'll take a look at V Marcy file okay so dr. Mathew file has to live in your current your home directory so if you hit city you go to your home directory and if you list the files then you can see if you're doing RC file is or existing or not and in my case it is not I just have a beaming profile which is another file that then generates for you it's where we in stores the state of state of like state of the files that is anything instead of its registers and macros and so on okay so this is automatically generated for you you don't want to edit this file unless you really know what you're doing but there's a second file that you can edit and it's called the master file and RC stands for run commands and if you have you might have seen bash RC or C shrc these these are like equivalent commands in bash and seashell equivalent files in bash and seashell and whenever you type in these files it gets run it gets executed and go every time this program starts so everything that you type in VMRC gets passed and executed five then when it is starting up so you get these commands run every time you launch them okay so okay so one of the things that you might have any of your master file okay so if you recall from our previous videos we have always used things like fit numbers and syntax on and it's painful because every time you launch them you have to do that again right and wouldn't be very nice if you could do write it somewhere and be more thematic aliy leave that for you every time it launched you that's what they must've pile is for okay so let's do syntax on oops and I'm gonna write include this file so now I have the MRC file and so it has syntax on and if I opened my Python file then voila without needing new types index on over here I have that already done for me quite so what else can we do in our be master file okay so the case you other commands like I could have set number okay and I could write this file and I could see in my Python file there's your numbers okay and you know to like see the changes you made it we Marcy take effect you don't need to actually expect a mass every time you could also do something like so if I set a relative number not a lot number of relative it's relative number and I write it I can just hit so4 source and you can type percent which means the current file what this will do is read the current file that is open which is Tomasi and run both those commands okay when I hit this so I get related numbers okay so in the numbers is where your current cursor position gets zero and all of the other lines are represented by the offset from the current line across the result okay so what else can we type we can also set ruler which is basically which tells you where your cursor is so if you go over here if you see over here you see your cursor is on line nine and character position not sorry line four and character position nine in that line okay what else so people are really fussy about using tabs or spaces and if you're one of the enlightened ones and you like using spaces and over tabs then you might want to you might want to have these things these configurations so what these do is every time you type tab then it will sort will be replaced by spaces and the number you have defined at the end of these lines represent how many spaces will let tab you to play spot okay so I'm gonna write this and I'm gonna sauce it source it and if I type cab then it is automatically replaced by two spaces okay so that's what they do so yeah these are a few commands that you can set and these are the commands that I definitely use in my view master file and you can also think that things like auto indent set things like spell checking and so on and so forth okay so and if you want to have comments on these these in the V master file then comments begin with a double code and you can type the comments after a double cut right and you can also have comments starting in this beginning the line so everything you type here is a comment if it is followed by if it has double quotes at the beginning and the other type of things that you can do with your be mercy is map your keys to do other things okay so the thing I mentioned in one of the first videos is if you're serious about them then you might want to disable your arrow keys completely right so I can move with minorities over here and this is not what you want to do this is against them to also you don't want to move your hand to bottom right of your keyboard to press they are key so I always have allergies turned off so what I do is map whenever I press down then do I know P which stands for an operation do nothing and I'll copy this and paste it four times and I'll do the same for up every time I hit up I don't want to I want nothing to happen and every time I hit the left I want nothing to happen and the same goes for right okay and save that so that those changes and now I'm hitting my arrow keys and nothing happens then just ignores the our keys okay and now you can only move with your head chequeo keys and that's what you want to do and another thing that you might want to do is that i do is i remap like i think hitting escaping is very difficult because it's all the way on the top left of your keyboard and you have to move your hand and you have you you lose track of where your fingers were right so what I like to do is I like to move it escaped to somewhere more accessible and the way I do that is every time the theme is in insert mode I remap nan recursively bond recursively means that just to remap once and don't like that it avoids transfer getting stuck in remap loop so what I do is I remap to escape okay so every time I hit JJ in quick succession when I'm in normal mode then it will escape to sorry instead when I'm in insert mode if i type J to quickly escape to normal mode okay and this is something that doesn't normally have occur in irregular typing so it shouldn't slow you down or confuse you a lot okay so I go insert mode and you in order to escape from insert mode I could type escape by moving my hand the top left or when I'm in insert mode I could now type change a and now I'm in normal mode okay that's that's about it for the VMRC file and you can also check out what are the scripts that are loaded with them by this commands script names and as you can see the masse from my current home is loaded and there's also a democracy from like default philosophy file that is loaded and it you might want to check that out what you see what it has also and a few other things okay so yeah that's it for the mastic file and that with that our introduction to vim series has come to an end hopefully this has been helpful to you guys if it has then drop a like or whatever and I might do more videos with him about him but those will be aimed towards intermediate and advanced users and if you've been following along then you'll be able to follow those can use to great thank you for watching tools
Info
Channel: Bishal Teaches Stuff
Views: 9,183
Rating: 4.8933334 out of 5
Keywords: vim, intro to vim, introduction to vim, vim text editor, yank in vim, yank, paste, vimrc, .vimrc, vimrc file
Id: zwAqbJH7gzk
Channel Id: undefined
Length: 10min 7sec (607 seconds)
Published: Sat Jun 03 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.