Awesome Neovim Setup From Scratch - Full Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] what is going on guys welcome back in this video i'm going to show you how to install and set up neovim from scratch now i'm going to do this on windows because i think that's what most of you guys are using as your main operating system but of course we're going to use the windows subsystem for linux so the process is a linux process so if you're using linux or a linux distribution as your main operating system of course you can take this process and apply it there as well so it's not windows exclusive because we are using linux after all um now before we get into the actual tutorial i'm going to show you my config i have a video on my config already and a lot of people ask me can you go through the installation steps because it's a little bit more complicated so this is what i'm going to do today but first of all i'm going to show you my neo vm config basically i have nurture installed so if i open a directory this is what it looks like i can browse through the different directories i can open the folder with all the recorded uh video projects for example we can go to the camera chat and i can open up the python file then of course i can open up nurturing on the side here i have this airline down here the status bar i can also open with f8 the tag bar there you go you can see here with the imports and the variables depending on the language we get different things here you can see that if i begin typing so import s for example i get all sorts of auto completions uh so socket for example and then of course if i use a socket so if i say s equals socket dot socket then i can see the function signatures i can say socket dot and then i get af inet and so on so this is actually a solid auto completion that we're doing here that we're using here um besides that i have all sorts of plugins like color schemes so i can use a bunch of different color schemes here let's go with deep space for example this is another color scheme um and essentially this is my config i have surround i have comment for example if i um select a couple of lines and then i say gc it's going to comment them out then i can say gcc to uncomment individual lines or two comment individual lines and so on so this is basically my neo-vim config it's uh simple but it's useful and we're going to go through the installation process now all right so the first thing we want to do is we want to go to the microsoft store and we want to install the windows subsystem for linux for this you can choose ubuntu opensuse debian and so on i personally use ubuntu but since i already have it installed and i don't want to uninstall it and lose all my configs and all that i'm going to use debian for this tutorial the process is the exact same because ubuntu is based on debian so everything that we're going to do today on debian is exactly the same on ubuntu so you don't have to worry about that pick ubuntu if you want to and follow along with the debian tutorial here it doesn't really matter what we're going to do is we're going to click on install and wait for the installation to finish all right so once the product is installed we can launch it and this will open up a terminal it says installing this may take a few minutes and once this is done we can enter a new unix username i'm going to go with neural nine and we can choose a password we have to repeat the password and then we can already use the debian system so that's how you install the windows windows subsystem for linux if you have some problems with this particular installation go check my uh go check out my video on how to install the windows subsystem for linux because maybe you have to set some bias options uh this is not part of the tutorial today if you want to have a detailed tutorial on setting up the uh wsl go check out that video uh for this video we're going to focus on neovim so what we're going to do next is we're going to say sudo apt update in order to get all the repositories we need to enter the password here and this is going to get all these repositories and whatever and then we are able to install some packages once this is done and the package we're going to install obviously is going to be neovim but you're going to see that a lot of the stuff that we want to have in the ofm is going to require additional packages so what we want to do first is we want to say sudo apt install neovim this is the editor itself we can say yes then it's going to download it to install it all right so once the installation is finished you can type nvm to see that neovim is installed uh you can also type nvm and a file name it doesn't have to be an existing file it can also be a new file if it's an existing file it's going to open the file if it's new file it's going to just create a new file and as you can see here we don't have any config we don't have line numbers no plugins we have the default version of neovim if we want to change that if we want to do some configuration what we want to do is we want to navigate to the home directory uh and in here you want to type ls minus l8 to see if you already have a dot config folder if you don't have one because you're just installing uh you just installed the windows subsystem for linux you want to create one so you want to say mk directory so make directory dot config like that you want to change directory to dot config and you want to make another directory in here called nvim and you want to go into that directory and here we want to create a file called init.vim and we're going to do this with neovim so init dot vim is going to be the file name and in here you can now start with your config so you can start by setting numbers so set number basically means we are enabling line numbers so the next time i open neo them you can see we have line numbers then of course i can also set relative number and now we have relative numbers so the line numbers are relative to the number that i'm currently at um this is a very basic uh config if you want to have my config if you don't know how to configure neovim and i would recommend that you figure out how to configure it on your own but if you want to have my config you can basically just go to github.com neural nine and you can go to the repository called config file so you go to neural nine you go to repositories you go to config files and in here you're having a init dot vim file so here you can just copy my config i'm going to copy these first lines because they're not plugins they're just basic vim configs so we're going to go into that and i'm going to set paste as a command then i'm going to insert and i'm going to press shift right click on windows to paste this on linux it's basically just ctrl shift and v i think and then we have a basic config here so set mouse basically means that i can use the mouse here as well number relative number we already talked about that and those are just some config lines about indentation and tab width and so on nothing too special now if we want to have plugins in neovim we have to install a tool that allows us to install plugins and for this what we do is we go to our favorite browser and we ask google or duckduckgo or whatever you're using about vim plug now if you are using some other plug plugin manager you can do that but in my tutorial since this is the one i'm using i'm going to use vim plug so you go to github.comgun vimp plug just google vimpluck and then you scroll down here to neovim now if you're using the ordinary bim you can also use this command here we're going to go to neovim and under the unix linux section we have this command here now as a general rule you should never just go ahead and copy some linux terminal commands and then just execute them especially if they're doing something with curl and sh but in this case we can trust the source so i'm going to do that i'm going to copy that and i also understand what it's doing it's basically just downloading the files and putting them onto my system so i'm going to execute that command but you can see here it says curl is not found this is because in debian by default curl is not installed so what we have to do is we have to say sudo apt install curl and this is going to install curl shouldn't take too long it's a very simple tool and after curl is installed we're going to repeat the command again so that is the command there you go that is it so all we need to do now is we need to go to the init vim file and we can start by saying call let me just see uh what the command was exactly because i always messed this up so we start with call plug begin and we end it with call plug hashtag end so call plug hashtag begin and then uh parentheses and then call plug hashtag end and everything in between is going to be plug followed by a link and this link is going to be the link to the plugin page so for example let's start with a very simple plugin the airline the vim airline we can just go to google and save him airline and we can go to the github repository all we need to do here is we need to copy that github link so control c we go back here and we say plug that and this will install the plugin this will add the plugin to our neovim config so i can run this again now one problem that we have now as you can see that vim plug requires git we don't have git because we're on debian we don't have git we say sudo apt install git and this is going to install git so we run that and we have to wait again for another installation we're going to have that problem a couple more times today so we're going to have to install some additional tools especially for some of the plugins most plugins don't need additional tools they're just working fine but some of them are going to need language servers some of them are going to need node some of them are going to need haskell or go so depending on the plugins that you're installing you will always have to install additional tools and because of that as a general rule of thumb i recommend googling a lot while installing new plugins because with every more complex new plugin that you add you're going to have error messages all you need to do is you need to enter them into google and see how to solve them of course for the plugins that we're going to install in this video i'm going to provide the solutions but whenever you encounter some problems especially when you're dealing with plugins and linux stuff and terminal stuff and neovim you want to google your way to the solution because that's how you do it that's how everyone does it and asking for help all the time is not going to make you a better programmer so that is installed now we can run this again and now we don't get the error message now you can see that nothing has changed even though i have the statement in order to actually install the plugin what we need to do is we need to say colon pluck install like that this is going to open this window on the left here and you can see that now when vim airline is installed and you can see that it's already loaded so down here we have the vim airline i can reload this again and you can see it's still working now on windows you will have the problem that a lot of the icons are not going to be displayable the first thing you want to do is you want to get a nerd font so you want to go to font and make sure that you have a nerd font and f in this case jetbrains mode on nerdfont again just google where to get a nerdfont how to install a nerdfont this is not part of the tutorial this is just some design stuff you want to make sure that you install a nerdfont on windows and load it into your terminal then you're going to be able to display most of the stuff however some of the stuff here is still not going to be able uh to be displayed especially if i go now and uh install nurtury for example let's just copy that here nurturey and plug install this is going to install nur tree now let's close this and what was it nerd i think i need to run this again do i nurtury was it focus there you go you can see that some of the stuff is missing so this this symbol here for expanding and closing certain directories is missing so what i did as a workaround here is i manually set the icons to be something else so in this case i had them be plus and a wave so i can just copy that and enter this down here basically i'm saying nerd tree deer arrow expandable is going to be a plus and collapsible is going to be a wave so i can run this again and if i now open nerd tree uh focus you can see that i have a plus here and if i open this i have a wave so instead of having to type all the time these commands manually what i have done in my config is i have key bindings so i think they're up here we have nurturing nurtury toggle and focus on these particular keys i'm going to copy that as you can do it um as well so you can also go to my config and copy that and up here i'm going to just paste that in this case this means control f is going to focus control n is going to just uh call nurture in general and ctrl t is going to toggle so let's run this again and if i now say control t this is going to open up nurtury i'm not going to talk about all the plugins because i did in my tutorial in my video where i showed you my config i'm going to talk about the plugins that are a little bit more complex so most plugins like surround commentary airline they're going to work without any additional hassle so i'm going to copy most of them i'm going to copy these four they're not going to make any problems here i'm just going to enter that i'm going to also skip some plugins because for example this one uh is only for postgres sql it's nothing uh or psql yeah i think that's postgresql i'm not going to need that all the time i actually can remove that from my config i'm going to get the color schemes and going to get css colors so i'm going to enter that here as well then we're going to also get def icons terminal and tag bar now tag bar we're going to skip it for now because that is going to make a little bit uh more problems so i'm going to copy that and then i think the last one should also not make any problems so once we have that we can run plug install again and this should install all these plugins by the way if you choose to delete a plugin so if you choose to no longer have a certain plugin you just delete it from here and then you call plug clean so plug clean is going to remove all the plugins that are no longer listed here but still part of the system so when i run this now uh we're going to be able to use all these plugins without any additional installation so for example if i use gcc this is going to comment out that line this is the commenting tool here uh i can use surrounding so i can just go and say y s i w and parentheses this surrounds the word uh again we're not gonna talk about individual plugins if you wanna see more vim content let me know in the comment section down below and i'm going to show you uh my favorite plugins and so on and i also have the video again on my config already the important part here now are the other two plugins so the first one is tag bar this is basically a tag bar for code navigation and as far as i know for the tag bar we're going to need exuberance see tags so if i want to install that i'm going to do that i'm going to say plug install and the next time i open that and try to call tag bar toggle we're going to get the message exuberance see tags not found now this is easy to fix we just say sudo apt install exuberant ctax like that and this is going to install everything we need so this is actually still a pretty simple plug-in we don't need to do anything exotic here let's see if it works now there you go we have the variables we have the mappings this is attack bar plug-in here i can also set the color scheme to jelly beans which is a color scheme that i'm using here and to do that by default i also have that in my config and i also have the tag bar toggle uh bound to the f8 key so i'm going to copy this what is the middle line complete preview no previous yeah we're going to copy that as well this isn't too complicated stuff here no problems with that so let's run this again f8 toggles this ctrl t toggles uh nur tree and you can see that we also have these icons now with all these different file types all right so that works the most complicated plugin to install is conqueror of completion this is the auto completion plugin that works for multiple languages in order to install that we're going to have to go through some installations so this is the plugin here coc.nvim we're going to go to our config again and add it at the end here um first of all this plug-in is only available for neo-vim you cannot use it in vim you have to use it in neovim it's a little bit special and if we try to install it you're going to see that we're going to run into some problems when we run the next time when we run neopin the next time so now you can see note is not an executable obviously what we got to do here is we're going to say sudo app install node.js and i think we're also going to have to install npm and we're going to have to install uh for the individual languages we're going to install uh the modules for conqueror of completion so we're not going to install plugins for vim or for neo them we're going to install actually uh let me while i'm talking just install npm here we're going to have to install uh 40 individual languages the individual modules so if i want to have completion for python i have to install cog-python if i want to have completion for the c language i have to install clang if i want to have completion for go i have to install the respective module there and so on so depending on which module you choose to install you're going to have different problems for example the c auto completion needs c lang the python needs jedi a language server uh and it needs pip and all that so i cannot show you the tutorial for all the different modules again it comes down to uh it all comes down to googling if you have some problem you just google to the solution for python i will show you the process for the different languages that you want to support you will have to find out what you have to do on your own basically just googling your way through the solution is always uh the process all right now once the node package manager so npm is installed what we're going to do is we're going to open up the file again and you're going to see an error message that says cog.nvm build index.js not found please install dependencies and compile cock.nvim by yarn install now in order to solve that what we're going to do is we're going to navigate to uh the plugged directory and we're going to go into conk dot envim and in here what we're going to do is we're going to uh to run yarn now first of all we need to install yarn so what we're going to do is we're going to say uh sudo npm install dash g yarn and this is not gonna take too long and once we have that we're going to say yarn install and this should also not take too long and what we're going to do after that it's important that you run it in this directory by the way so you need to go to the home directory config nvm plugged cock.nb and then yarn install in here and we're also going to call yarn build and then we're actually done with the actual uh plug-in setup but for the conqueror of completion we're going to also install a couple of modules now it's done let's run yarn build and that's actually it so let's go back and call nvim init vim and you can see that it's working down here and basically that should be it for this plug-in still creating something it doesn't matter let's go ahead and try some autocompletion on a python file so let's say nvimtest.py and you're going to see that it doesn't work yet so if i go ahead and say import and then i don't know t it doesn't say anything so it doesn't recommend anything even if i try to trigger auto completion it says pattern not found so what i'll have to do here i have to go ahead and say colon install so coc install and then coc-python for python of course for the different languages you have different modules just google uh conqueror of completion go conqueror of completion ruby and so on in this case we're installing the python module it's done and when i now exit and try to open this again it's going to say something hopefully actually it found the python interpreter why is that why does this work already it doesn't work does it i cannot cause autocompletion now i think we cannot really see the error message right now which is unusual but we have to install a jedi language server so first of all what we're going to do is we're going to say pip or actually we need to install pip first so we need to say sudo apt install python 3-pip in order to get the python package manager and with this package manager then we're going to install jedi and then this should be enough to actually be able to use auto completion in neovim okay seems like i was too stupid to click on record again all i did is basically after the installation of pip i just ran pip 3 install jedi so pip 3 install jedi this installed jedi and that's basically what i did um then we can go ahead and open up the test.py file again and we can try to see if the autocompletion works wait for the interpreter to load there you go searching interpreter there you go and now import t and you can see it works so i can go for time i can say time dot sleep for example and you can see i have the signature here the documentation and that is basically my config now you can go ahead and open up nurturing you can open up the tag bar you have the def icons in here uh you can also open up a terminal so terminal split bash for example there you go now you have terminal uh and you can build your own ide like that you can extend the config i think we didn't include in this video all the things so for example down here i have the auto completion using tab uh and all that but essentially if you copy my config and you follow the instructions this is how you build your own ide you can extend this with a bunch more plugins of course again google your way around all the error messages i think sometimes you're going to get the error message that the lyncher is not installed then just install it for this unique pip and so on google google and google that's how you solve the problems and this is my new vim config a very basic one you can always extend it as i said but this is how you set up neovim from scratch on windows and on linux so that's it for today's video opinion hope you'll learn something if so let me know by hitting the like button leaving a comment in the comment section down below if you want to see more vim content vim related content for example my favorite plugins or how to set up a certain plugin or me reviewing a certain plugin if you want to see content like that let me know in the comment section down below i actually enjoy that content so i would be happy to hear that you guys enjoyed as well uh besides that also don't forget to subscribe and hit the notification bell to not miss a single future video for free other than that thank you very much for watching see you next video and bye [Music] you
Info
Channel: NeuralNine
Views: 36,259
Rating: undefined out of 5
Keywords: neovim setup tutorial, neovim installation tutorial, neovim config tutorial, neovim plugin tutorial, vim setup tutorial, neovim autocompletion tutorial, neovim windows tutorial, neovim windows setup, neovim wsl tutorial, neovim, neovim linux setup, neovim windows subsystem for linux, how to setup neovim, how to install neovim, how to config neovim, how to install neovim on windows, neovim installation guide, neovim config guide
Id: JWReY93Vl6g
Channel Id: undefined
Length: 25min 49sec (1549 seconds)
Published: Mon Oct 25 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.