 Today we're going to be looking at some VIM stuff. Basically my VIM configuration. This is a video I've wanted to do for a while. People have asked for it. I have VIM set up how I like it. VIM is great it's very customizable and For a long time I've taken all my configurations for VIM and I put them up on GitLab So you can get them there, but haven't really talked about it or shown it So I thought I'd do that. Be aware that this is something I wrote for myself I'm just sharing with you so it might not be the cleanest code But it works for me and I'll share it with you and show you how it works. Basically, it's going to Warning because it will overwrite your current VIM configuration and Tmux So you're going to want to make sure you back up yours if you use those two programs Which you will if you're going to start using this configuration It's going to install a few packages. So when you run the script to install it It's going to ask for your pseudo password Don't trust me. Don't trust anybody else if you download code from online Especially if it's asking for a root password at least glance over the code the installers very short you can look at it It's you can see it's using the pseudo command to again. This is designed for Debian systems It's going to run apt to install a couple packages the current version of them FZF and maybe one or two other things Tmux and Yeah, so let's go ahead and have a look at it and See how it works. Okay on the left here. I have a virtual server I just set up with a minimal install of Debian so it's fairly bare on the right I have my VIM project on GitLab. It's GitLab.com forward slash mail X1000 forward slash my VIM setup There should be a link to it in the description of this video If you don't see that forget to put it there or you try to find later. Just go to filmsbychris.com That's Chris of the gay. That's my website click on software down here. You can click on GitLab and When you're there you can see all my projects This one's usually high up on activity because I'm constantly adding new templates to it But just go there and you can clone it or in this case just keep things simple in this video I'm going to right-click and copy the zip file Over here on my server. I'm going to download that zip file. Let's go ahead and make this full screen unzip that zip file Takes a second. It's very small. We'll move into that directory We will list out the files and you can see we have a backup.sh and an install.sh The backup.sh is mainly for me, but it could be for you if you were to clone this project So basically what that is is after you do an install of this configuration It's going to copy all your configuration files to your home directory If you make any changes to your VIM setup you can go back into this project run backup.sh And it's going to pull all those changes and you can push them back up to GitHub or GitLab The install.sh there's two options for that. You can just run install.sh or you can run install full So what's the difference? We'll go ahead and start running that. This will probably ask for your password I recently just typed it because it's going to try to run commands as soon as you see it's doing some App stuff to pull down some packages. So it's going to need your password Again look at the script. Don't just trust me. It's a very short script. Make sure it's not doing I'm just saying that in general. Don't trust anybody. Look at the script. It's only a page long But that's why it's asking for your password. It's going to try to install a few other things You just go ahead and enter for most of those You'll get an error right here because it's looking for a color scheme that we have not installed yet So we need to install our plugins, which is what it's trying to do now We'll go ahead and enter. The first set of plugins installs super quick We can then quit out of VIM with colon Q Exclamation mark. Do that twice. I should see if I can have the script automatically X out after installing the plugins Then it runs the second batch of plugins. This is the part that takes a little while is that you complete me It's a auto completion plugin. It's got to compile some stuff that takes a little while But should automatically do it and that's the difference between just running install dot sh install full So install full you only have to run the first time theoretically it It's going to do all the app stuff and bring down the plugins and compile what needs to be compiled If you just run install dot sh without full it's just going to copy over the config files So I'm constantly making changes if you want to get those changes you clone the repository again or pull an update of it and just run in this case we'll say dot slash install dot sh and You can see how much quicker that was because it's just copying over the config files without having to install all those Applications either way it doesn't take very long It even reminds you if you run it without full here to run it for a full installation And I have a flash so that it reminds you if this is your first time installing it on a system Okay, so now that it's installed. Let's go ahead and have a look at it Okay So again, there's a lot of features in here adds it adds a FZF fuzzy finder features that will look at a little bit Mainly for switching through buffers and also it will you'll see with my templates I usually have it set up that you I had these templates You'd start typing something like for my java script templates You type JS then you hit control xk and it would bring up a list and you can scroll through them Or if it was a shell script template You would hit type sh and then hit control xk and you would type through the search through the list I changed it once I learned about FZF fuzzy finder now as I'm about to show you you can start typing you hit Control T and it brings up a list of all the templates and you can start searching just by typing and then basically It's a shell script that's going to cat out that template into your current project and these could be sometimes they're just you know Short functions sometimes they're single commands. They're just long sometimes. They're full-blown webpages or scripts So let's have a quick look at that. Okay, one important thing the installer installed Tmux But it does not start it up and you need Tmux for some of my functionality So you're gonna want to type in Tmux now if you do this and you run it and you get an error about key binding on line 8 that's because between different versions of Tmux they changed how some of the key bindings are listed and So if you're running a different version of Tmux, then you might give you that error You can just either hit enter or control c to get past that it's not a big deal if you use Tmux a lot You're gonna want to go in there and adjust that yourself But hopefully at some point we'll all get on the same version of Tmux and that error will go away But it's not a big deal. So once that's the case we can go ahead and start creating something. I'm gonna say Vim We'll just say test Dot sh sure now I can I to go into insert mode and I can hit control T and it brings up all my skeleton files These are all my templates and they're in different folders. So if I wanted to do like a C program I go GCC and it lists out The different inputs and stuff I can I can go something like a hello world and it posts a hello world Function with the headers here with the GPL and stuff like that So you can start off with a basic code like that It has up in here you comment this out if you're going to be using it as a server side script for in a C CGI bin you can uncomment that and it puts the plain text or you can change that to HTML if that's your output let's go ahead and delete that and Let's just look in again. I have them all listed. I can type in HTML. Let's solve my HTML stuff I don't really use bootstrap anymore but I left my old bootstrap templates in there if you use them again I constantly add new templates. I don't really move the old ones out phaser if I choose that it's going to list out All the basic template for using phaser now. Let me go ahead and Actually make this a test dot ht. Oh, that's H HTML and again, I'll do T and I'll do phaser That's a JS I can do phaser HTML and you see now that I've set it as an HTML it auto indented stuff Now, let's say your auto indenting gets messed up. You copy and paste something in here. So I'll just do this So let's do that. So I messed up some of the let's do a little bit more Just getting rid of all the indentations here so all the indentation and Again, you want to make sure you have your file labeled properly because it looks at the the file extension to know how to indent files, but you go ahead and hit f6 Indents everything f5 removes any tailing white space. So if for example, I Was here and I had a bunch of white space here Which is just wasted information and sometimes when you copy and paste code that happens if I hit f5 It's going to move remove on all lines through the entire file any tailing white space So f6 to to auto indent f5 to clear out those things f6 is one that I use all the time that I have in my configuration So that's cool. So we've looked at two different things here. We've looked at auto indenting stuff With f6 clearing out the lines code and then again when you're in insert mode control T We'll bring up the templates again. Sometimes they're full scripts. Sometimes they're just sections of scripts so like JavaScript on key up here's a function for Listening to events. So it's not a full HTML page with JavaScript But it's this is a function you would use with some examples for getting keystrokes if I hit f6 here It's not going to indent properly because I have this as an HTML file If I exit out of this and I create a new file called J s and I do J s input let's just do J s On key up There see it indented properly because it's a JavaScript file so you want to make sure that you have your files labeled properly now it should if we Exit out of this and make it an HTML file again, which I saved this last time I'll just go ahead and say Do-do-do-do basic Index so here's just a bare minimum HTML file with I don't say bare minimum just like the setup I like for starting webpages. I got some flex settings. I got stuff set up for small screens I've got a function here to wait for the page load and I got some basic input stuff If I was to then add well, you can see there's JavaScript in here But let's go ahead and add some more. I'll go control T. I'll go J s and I would say I want to do a post Here I can do a post function and you can see it auto-indented because even though I'm in an HTML file It's now indenting the JavaScript properly because it's in the proper script tags. If it wasn't it wouldn't indent it properly But yeah control T. You can look through all of this I got lots and lots of templates 3js, which is for creating 3d stuff in web browser. I got CSS stuff I've got a lot of HTML stuff a few Python things a lot of bootstrap. I don't use that anymore some phaser stuff navigation bars and again a lot of um if you do GCC I've got some C code here for creating a basic hello world file for getting user input writing the files using colors on your output and see stuff and Against more HTML stuff. So that's stuff that I just use regularly like if I want to create a progress bar or a button or A photo gallery I have a couple of photo galleries in here for that are CSS and HTML So I can if I want to have a photo gallery on a web page I can just run that and it puts the basic code there and then I can tweak it and modify it for different things They both have modals. So basically when you click on an image, it's going to bring up a Little full-size image of that picture So that that's oh, yes, don't want to forget other functions. So let's go ahead and just Say I want to open up multiple files Let's go ahead and save this one even though it's all messed up We'll make the Vim. J s and again We'll just put in some JavaScript code here phaser JavaScript, whatever so now I have this open Now I can hit comma F when I'm not in insert mode So I'm not typing stuff and it's going to list all the files in my current directory and subdirector So normally you're in a project folder So here my other file was called test dot HTML I can type that in using fuzzy finder real quick. It found it. So now I have both things open I can now hit comma B and it's going to open up this screen and it lists all of my Buffers that are open. So I I'm at the HTML one. I can go to the JavaScript one Let's go ahead and pick another file. So again, I can hit comma F for file It's gonna list all the files in my current folder and subdirector So I'm in a project or whatever and I want to go let's say I want to go to the license You can see it there I can arrow up to it or I can just type in LIC up and it brings me to it I can go to that or the GPL license here, but I'll go ahead and click this So now I have three files open three buffers comma B will list them and you can see That I have HTML I can go to JavaScript I can't go to the license some already at it, but I can go back and forth between these so comma F I can again look through these different files. I'd say I want to open up the read me file It's now open comma B for buffer It's going to list all the files and I can pick which one I want to go to so they're all open So I can be working on multiple files at once. It's easy to search through them It's easy to find them and then You know if you do make changes to one and then move to another And then you try to exit out It's going to tell you oh you have changes in the buffer test.js that you didn't save So it'll bring you there and then you can write those changes and then you can exit out No problem, and if you have multiple files that have any changes It will bring you to each one as you try to exit. So those are the main things I use it for I I think I've added other functionality mainly those plugins, you know, obviously I have it set up So you have the numbers over here the line number that you're on and then you can see the other lines So I have the relative line numbers So you might ask what that's for if you're not familiar with that right now on line 8 you can see that right here But let's say I wanted to go up to this line up here If I didn't have relative numbers that'll be listed as line 2 and that'd be easy I can go to line 2 but let's say I'm at You know a couple hundred lines down. I got to do the math to move up here. I can see 6 I can see this is line 6 up. I can just hit 6 and hit up and it will bring me to that line So I can say let's say I wanted to go to this update function I can just type in 10 and down arrow and it brings me to it if I want to go up to this create function Or in between the create function I can hit set 3 up and if you're only moving a couple lines It's not a big deal, but if you're jumping all the way down the page it makes a difference So yeah, I'm trying to think if there's any other functionality I have in here Obviously it has the color coding. I like the line numbering. I like the big thing is the templates the control t You're going to get to be an insert mode control t to search these templates And it's just anytime there's something I create regularly or use regularly Or think I might want oh if you escape it will say cap it because it is trying to run a script there You can just delete that But again, I'll just delete all this and give you an example If I wanted to do css Oh, so buttons. So that's the css. So if I This is my I can go through all these I I probably shouldn't be going through all my different templates because it's boring Maybe I'll do a separate video on that if you would like to see that But this is the css for my default html page and then I have different colored buttons And the different css for that So I hope that wasn't too complex. I hope this is something that you guys might find useful people have asked me about it before Um, but yeah, if you just remember control t, that's the big thing and then obviously control six for Auto indenting because that makes a big difference, especially if you're copying paste stuff I haven't set up to automatically use two spaces for the indentation I don't like tabs and a lot of people use four spaces. I think that's too much Things get indented too much. So I have it set to two tabs But yeah, again, this is all stuff I made for me Um, but uh, oh, yeah, it's another thing. So you're exiting out of vim So I want to exit out lots of times. I'll hit control Uh, I'll hit shift q down here By accident. I have it set to exit. Oh, it should be should exit Oh, yeah, so it's automatically changing and if I do control exclamation mark and then hit enter Okay, yeah, I guess as long as I don't backspace or anything if I backspace that changes stuff up It'll work that time. Anyway, you should be able to do a capital q and exclamation mark It always works when I'm normally exiting out Um, so because it's you tend to hit shift colon and I'm going to hit shift to the exclamation mark So I tend to accidentally hit shift for the q it's going to automatically change that to a lowercase q for you I like that. Um, although somebody's going to recommend doing something even shorter than that I think in the comments. Anyway, thanks for watching Uh, let's see and I hope that you have a great day films by chris.com. That's chris of the k Again, right here and you go to software and go to my get lab page or check out the links in the description If you like my videos, check out my patreon page get videos early and support me I I do appreciate it and I hope that you have a great day