Learn How To Use NeoVim As An IDE - OLD Version, view my updated video

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to programming Percy today we'll be having a look at learning new whim many years ago I tried neovim for the first time and I ran I rank quickly it was hard to configure and I really didn't understand what I was doing so I kind of gave up now some time ago I decided to give it a new try and I'm super thrilled that I did because it's just so amazing to work with when you know what you're doing sadly I see a lot of developer asking why spend a few hours setting up an editor when you can just use Visual Studio code and I I agree somewhat but if we're going to work with a tool every day in our job is it really such a bad thing to invest a small amount of time making it really good the reason why I do recommend any of him for people to use is because it's super customizable you can really modify the editor to become whatever you want to behave the way you want when you press this and that button do this and there's really no limits to what you can do the Khan of neovim is the same argument there's stuff that you need to configure it takes some time to configure but once you get the hang of it and once you learn how you'll notice that it isn't actually time consuming and it's actually really easy it's just in the beginning it might seem a little overwhelming and that's why we're here this tutorial tries to provide you with the tools needed to get started with Newman I won't give you the perfect IDE configuration to use which makes your editor look amazing that's not what we're doing here if you're only after that you should search for people's dot files which is the way we reference the dot files because they're hidden files that you use to configure neovim and you should search for them if you're only after a full complete configuration this tutorial aims to teach you how to create those configurations by yourself and I don't expect any previous knowledge of neovim or VI we will cover everything as we go and you know what they say hand a developer an IDE and he or she will code but hand a developer the ability to configure and customize his IDE and they will become developer gods at least I'm pretty sure that's what they say let's get going the first thing that you need to do to get started with neovim is installing it I recommend going to the neovim GitHub by searching on Google for neovim GitHub going to Wiki and at this location you have information about how to use it you also have installation instructions which are great so go ahead and at this place you can find how to install it you should select the most stable release so it's a lot easier to work with there's installation instructions for you hi here as you can see here the for Linux as example which I use I need to download the neovim tar file extract it and then simply run the binary you can find the files below here so you could go ahead copy the link and switch to a terminal and do a vget for that five and it will download that file and once you have that file untour it using tar xwf and the name of the neolim file so once you downloaded it and untard it you can execute neovim by using the binary found inside the folder which was untard and then slash bin as you can see here I have the new neovim binary we need to add that to your path I have my I have mine inside of a file called bash aliases but you cannot you can use bash RC or whatever you use to add your aliases and as you can see here I have an alias called neovim or nvim and it's pointed to that binary you can also just add the neoving binary into your bin path it's all up to you how you add it let's go ahead and close that so once we've added neovium as a binary we can start configuring it configurations by default goes to your home folder slash dot config slash nvim so this is the default path that it will read from so I'm just going to go ahead and create that folder and move there because this is the place where we will be working once you start neovim without any configurations by executing the binary it looks like this nothing special but not so shabby beginning to configure navim is what I hear people are scared of many times it's confusing but it's actually not so confusing once you get started you've opened up neovium like me you're going to shut this down you can see the prompt here saying type colon queue enter so that's actually how you enter commands so if you press shift and hold them and then colon you'll see here at the bottom you get a colon prompt this is the command prompt where we can enter commands and what I'm going to do is go ahead and type Q and enter and that will close any of him Q is short for quit shift plus colon is how you trigger the command prompt and that's important to if you are not familiar with VI that's really important to remember so before we configure it we actually need a plugin manager who can help us configure and download plugins for neoim everything you do in new VM is usually changing the configurations or downloading plugins to help you so it's really good to have a plugin manager we're going to use a plugin manager called Packer and Packer can be found on GitHub as well what I recommend you to do enter their GitHub and scroll down to the quick start and it will show you how to download it I'm using Linux and you can see that they clone the repository and they actually move it into dot local share slash nvim site don't change this unless you know what you're doing just simply use the command because this is the default location where neovium will look for stuff so just copy the command run it in the terminal and it will install Packer for you so copy the command from their GitHub paste it into your terminal execute that and you will have packery installed to begin configuring neovim we need to create a new folder and that folder should be placed inside your home path at dot config and a folder called nvim so go ahead and create that then we will go there so once there at this location we will store a few files so let's go ahead and create the file which actually starts up Packer the plugin manager and initializes it so I'm gonna go ahead and create a new folder in here called Lua configurations in any of them is done using lugoscripts and if you name a folder Lua that folder will be automatically checked whenever we import the scripts in neovium so inside Lua I'm gonna go ahead and open up and create a new file called plugins.lure this file will be responsible for handling all the plugins inside of our configurations so the first thing that we will need to do is press I to go into insert mode and then we're going to require packer which is the plugin manager once we've required that we're going to execute the startup function and pass in a Anonymous function like this so we require Packer we call the startup and we insert a function an R function you can see that we have use here and use is a way to import other plugins let's add a comment here configuration is going here in our case we want to manage packer itself as a plugin this allows us to update Packer whenever there's a update that needs to be done what we can do is after we've added Packer we can press escape to leave insert mode and go back to normal mode press shift colon to open the command command tab and type in w to save the file if we restart neovim nothing is going to happen we have only created a script that loads in packer but we haven't told any of him to use this script so we need to do that neovim has a special file called init.lure and init.lure will be automatically loaded once newbeam started and executed we will go ahead and use the inbuilt Explorer to go there press shift colon to open the command Tab and type explore with a capital e which will bring up net rewriter and as you can see we have the plugins lower which we just created and we can go up one step to the parent folder and we can see our Lua folder which holds our Lua configurations and at this place we will be wanting to create the init.lure so I'm gonna go ahead and press shift percentage sign and it will open up a command tab saying enter file name because we're creating a new file and I'm creating a new file called init.lure and this file I will go into insert mode by pressing I and this is the file that is executed by neovim once it started and what we will do here is that we will require plugins which is the plugins.lure file that we created note you don't have to write luas slash plugins.lure you don't have to do that it's enough to Simply say plugins and it will know it's a Lua file inside the Lua folder so once again press shift shift colon to open the command tab press right now I'm going to go ahead and restart neovim and nothing has changed as you can see but we have added the ability to run Packer so we can go ahead colon Packer status and we can see we have no plugins available so far and it brings up this little tab where it shows us the output from Packer which is nothing so press Q to go back go into the command tab shift colon type Packer sync packersync will download and install plugins for you it will remove any plugins that are not available in your configurations so it's a great way to create track and keep your plugins updated Packer sync so in short what we have done so far is that we have learned how we can use Packer to import plugins we have learned that neovim has a init.lure file which we can use to load our configurations we can run commands by pressing shift colon such as the Packer sync or package.us and we can navigate using the explore command so let's press Q to bring that tab down and let us add a few more plugins that we will need now since we're going to learn how to use neovim as an editor I think it's good that we would install some language server support and to do that I'm actually going to use a plugin from William Bowman and you can find links in the descriptions to these plugins later so you can see more about them but Mason is a plugin used to help you install co-related stuff such as dap servers or LSPs and stuff like that we're also going to use this LSP config neovim plugin because that's used to configure it and then we will also download a plugin called nuvim NVM LSP config now LSP config is used to run different language servers and it's needed for these plugins to run properly so once we have added these plugins Mason to download and help us set up LSPs and neovim and LSP config to configure them once this is done let's exit the insert mode by pressing escape shift colon and write the file if we do Packer sync now it won't actually so I'm going to go ahead and do it Packers sync it won't actually do anything it won't detect the changes I'm going to go ahead and close that we need to reload the file either by exiting Vim or reloading it in line we can do that so let's do shift colon to open up the command tab Lua file and a percentage sign what this will do is that will it will reload the current buffer now the buffer is the file so it will reload the buffer into memory again so that's the same thing as closing it and opening it up it's just a little bit more easy to do that so let's go ahead and do shift colon and type Packer install you might as well type packersync Packer install will download and install the com plugins for you it won't remove old ones so it installed three plugins that's great so let's press Q to exit now one thing that we need to I need to clarify is that Packer downloads the plugins for you it doesn't configure and enable them automatically for you that is up to us so let's go ahead and do that now in this example we're going to set up go PLS which is the go language server to help us code in a go related file but you can really use this approach for any language that is supported which is most of them and we're going to enable our first language server and we're going to use Mason to do this so actually I'm gonna go ahead and create a new file so shift colon type explore and you can see right now in our luau directory we only have one script which is the plugins I'm gonna go ahead and add a new file here so you can do that shift percentage sign and then enter the file name and I'm going to call it masonconfig.lure this file will hold all our Mason configurations remember to not name the file the same way as the plugin because there will be conflicts if you do it for instance if you name it Mason it will be a conflict press I to go into insert mode and we're going to require Mason and call the setup function so we used Packer to download Mason but now we also need to configure Mason to work the way we want and each plugin has a setup function which will set it up with the default settings which is fine for us right now let's use the default settings now we're also going to use the Mason LSP configuration plugin and again we're going to call the setup function to set the defaults up press escape to leave insert mode shift colon and W to write the file and once that is done we're not exactly done yet we need to do the same thing in the init Lua that we did with the packer so go ahead shift colon explore we go up one level and we go into the init.lua file so the same thing that we did here we told nuvim to load in the plugins script we need to tell it to also load in the Mason config script I'm gonna go ahead and save this file shift colon W and then shift colon Q to quit I'm gonna open up new of him again and there shouldn't be any difference so we can check our plugins but and this is really useful when you're trying to set something up and it's not working because that would probably happen sometime so go ahead and open the command tab shift colon type in check health and it will show you the health of all the plugins that are currently installed now one thing you need to know about Mason is that it helps you install tools for development such as gopls however it does require you to have the binaries or the programming languages installed so you can see here it tells me I do have go installed which is great I don't have cargo for instance and I don't have node and if you don't have go installed it won't be able to download gopls for you so you can still use Mason even though I don't have cargo but I won't be able to do cargo related stuff using Mason we need to install that first in this tutorial we will be using go if you don't have go installed now is the time to pause this video and go and find the go and go into Go download and follow the instructions to download and install go if you want to follow along and the things that we will learn here will actually work for most of the programming languages so you could use another language if you're more familiar with it but if you want to follow along and do exactly the same download go from this link I will put it in the description once you have it installed and put it in your binary path you should be able to see go here okay so check Health user super useful to check the health of the current plugins so I'm gonna go ahead and type Q to Simply quit and close that tab down we did install and configure Mason so let's go ahead and do shift colon to open the command tab type in Mason and you should see this really nice looking pink screen now in here you can see we have LSP dap for debugging linters for linking and formatters which Mason can help us install this is a long list and you probably won't know the name of the language server by default but if you're interested for instance I know go PLS is related to go and we can see up here there's a language filter by pressing Capital C and capital c when you see that in neovium configurations that is actually control so capital c means control and then f so if you go ahead and press hold Ctrl press F and it will open up a new tab and that will have all the programming languages that we can apply as filters so as we see here go is number 47. I'm going to go ahead and press space until I get to the bottom and I'm going to type in 47 and this will apply go as a filter now I'm only seeing go related stuff and if I go down here I can see go PLS and we can press enter to see a little bit more information about it now we want go PLS so I'm going to go ahead and do shift colon to open up the command tab I'm going to write Mason install gopls and you will see that it starts downloading go if you have don't have go installed it will complain here telling you that you don't have it okay so it installed go PLS for us which is nice and we can go ahead and press Q to leave Mason that was really simple but there's one thing that we need to know we installed go PLS we still need to configure it the same thing we did with Mason and others we need to apply it's really simple it's really the same thing as we did before so I'm gonna go ahead shift colon type explore and inside here we can see we have two we have the two configurations as before I'm gonna go ahead and shift percentage sign and I'm actually going to create a go PLS dot Lua and go PLS will hold the configurations related to go PLS for me and I'm going to go ahead and configure it so that neoviem knows how to use go PLS so the first thing that we want to do I'm going to insert mode and I'm going to require the LSP configuration from the plugin so we can attach go Payless to it and the way we do that is we create a new variable we assign it the value of require LSP config this will import the LSP config Library allow us to use it and configure it we're also going to use the util package so require LSP config util now we have imported the plugin we can start configuring it now each you can use this plugin to configure many language servers the way you configure a language server is LSP config dot the name of the language server you can find a full list in their documentation I'm going to put links in the description I know it's called PLS so let's go ahead and call go PLS and we will call this setup function and the setup function we will close it with brackets and inside here we can start configuring it to run go PLS it's a command line tool so it will use gopls from the command line and it will use Serve this is how to start go PLS we're basically telling neovim how to run this plugin and we want to configure the file types to run it on and I want it to run whenever I have a DOT Co file or a go mod file for instance you can add more files you can really control this to work the way you want and the root directory to use will be util root pattern go work we will use go.mod and Dot get this is basically the path to the root folder where the plugin will run so you're telling it that start running from this path so whenever we see a go work file go mod file or a DOT git that will be the root path now we can also configure settings and this is how the plugin will work now this is if you have gopls running by default you have to tell it what analyzer to use for instance and you can do that here in the settings tab so we can do settings and we can say go PLS and goplus is going to run we're going to have that analysis to tell you what to analyze and basically we will call we'll check for unused params for instance we want that and we will also enable static checking so this is how you would configure a LSP for gopls now to do the same thing for example rust we will simply go ahead we would do LSP config so we would have a code LLB for instance but let's not do that now but hopefully you understand how we can customize that plugin and if you want to know what settings are available all of this exists inside the plugin documentation on GitHub so it's really easy when you see me writing this you might think oh how will I ever know what's going on but actually it's pretty easy if you check it in the documentation you will see they will have examples of everything and it's not that hard I'm just going to go ahead and add those columns there because they're needed so let's go ahead let's leave the insert mode shift colon right now we have one thing left to do and hopefully you have an idea of what it is we will need to update the init Lua to use the configuration that we just wrote so let's go ahead explore mode Let's go back One Step Up let's go inside initlova and of course let's add it so require go PLS and Let's Escape shift colon write the file and let's exit now to test this out I'm going to create a super super small goal Lang program and I'm just going to go ahead and do neovim main.gov which is and you can see it's actually complaining we cannot have end of file so our language server is actually working I'm just going to go ahead press I to for insert mode I'm going to do package main to just see a few things that I that they are actually working so I'm going to create the main function and I'm going to go ahead and do VAR test string and I'm gonna do font print line hello world and press escape and once I do that actually we can see the language server is working it is complaining and it's telling me that I have errors in my code I'm going to go ahead and just save this file anyways because we will be using this later so we are one step in the right direction we can see errors but I don't know if you noticed but there's no code completion or suggestions which is really important we have an editor so let's go ahead and add that and to add that we need to drumroll wait for it add a plugin same as always so we will be leveraging a plugin from Hirsch 7th I think you pronounce it hurt seven sorry if I pronounce it wrong he has a whole Suite of plugins in GitHub and I will put links in the description to all of them and I won't cover them all in details because there's quite a few of them but while I write let's try explaining a little bit what they are so let's go ahead let's go inside oh sorry wrong let's go inside Lua let's go inside the plugins again and we're going to add plugins for code completion for instance I like having a few comments sometimes just to make it a little bit easier to understand what's what so the first one we're going to use is Hersh seventh slash nvme CMP now this is the completion plugin and it allows us to add completion engines to new them and the great thing about the plugin is that it supports many languages sometimes I see plugins which are related to one language you install it and it does one thing but this is really useful because you can use it for many languages and here's a complete list of supported stuff on his website and it's just I mean it's just great so we're going to be adding a few plugins so um at this point of time I think it's probably good if you learn that if you exit insert mode and go into normal mode you can press YY double tap YY and then p and you will copy paste the current line that you're in so I'm going to go ahead and do that that's YY followed by P so the first thing that we installed was the NVM LSP which is the engine now there's something called sources which the engine then uses to add functionality to it and we're going to add a few of the sources and all of them begin with CMP NVM so we want LSP Source we want a Lua source I'm just going to go ahead uh add a bunch of them so we have nvme LSP signature help which is used for displaying function signatures with the parameters and we're gonna do NVM NVM LSP is used to add the language server as a source to the nvin CMP which is used for code completion so that's what we're doing we're adding code completion sources here it's going to be more apparent soon so let's go ahead and do cmpv snip and that's used for adding and enabling and adding the ability to create Visual Studio code Snippets this is the same way if you're familiar with them I'm going to add CMP path which and I'm gonna add CMP buffer now path is used for enabling the file system as a source and the buffer is used for adding buffer words right I'm also going to add one final which is oh sorry let's copy that one which is the Vim V snip so there's gonna be links to all of these in the description don't worry um basically code completion with this one and then these are sources which basically adds functionality to that completion so once we've done this let's go ahead escape to exit insert mode shift colon write the file shift colon do a Reload remember Lua file percentage time to reload it and then I'll run Packer sync and it will download all the plugins for us and as we can see it all downloaded perfectly so that's great now again let's press Q to exit and as always we need more than just downloading the plugins we need to configure them and initialize them so I'm gonna go shift colon and explore command and at this place I'm going to do shift percentage to create a new file I'm going to call it code completion.lua because all our code completion related stuff will go in here one of the things that we will begin doing is adding a small pop-up frame with the codes adjusting you know when we're typing we want the code suggestion to pop up at the cursor now one way of doing this is adding it to the Vim opt ion and there's a few options by default in neovim which you can use I'm gonna go ahead here I'm gonna paste in I'm going to go to the documentation so whenever you're configuring neovium it's great to know the new Vim documentation is really good I think so you can visit here to see what options we have and we want a we want a completion option and we want to display it as a menu so we can go to the documentation search for a complete opt and you will see a bunch of options that we can add to that and I'm just gonna go ahead in my editor and type I'm just type complete up this used to manage manage code suggestion format and we're going to say vim.opt which is the option for whim and complete option is equals to now I want us to have suggestions pop up even when there's only one suggestion because by default you won't have that so I'm going to go ahead and do menu one and you can find that by reading the documentation so we can see menu one use the pop-up menu when there's only one match and I want that so I'm going to add that I also want to add no select which the options which is an option that allows or forces the user to select one from the menu and I'm also going to add no insert which which is an option to tell us to not insert the suggestion before we have selected it otherwise it will print it depending on what you select but we want only it to be entered into the file when we select it I'm also going to add the preview to show some extra information again you can find what these options mean on in the documentation on new them I'll put a link in the description so you know when you're building your own editor how to find these options I'm going to go ahead and close the browser now because we don't need it so we added a few options that will modify how the completion will behave but this is not part of the configuration this is part of the neovim configuration I'm going to do and I'm going to add one final thing which is short message so Vim up short Mass plus C equals true and this will make this will prevent the messages from being excessive or very very long we want to use the CMP plugin for our code completions so we're going to require in a variable the CMP and then the same thing that we did with the language servers we can now use the plugin and we can call the setup function and we can pass in a object with configurations so this object will hold our configurations so this object will hold our configurations and the first thing we need to add is the sources that we added as plugins as well so sources are installed that can be used for code suggestions so it's the source for the code suggestions so let's go ahead add a sources option it's going to be a object and at this and it will hold objects and we will basically just add the name to the source and that will enable that source to be used and we can also configure them here we will be doing that for some of them so I'm going to go ahead once we've added this I'm going to go ahead press Escape I'm gonna press I'm gonna double tap Y and Then followed by P to copy it a few times because we have a few sources like that and I'm gonna go ahead and change the name to match the other sources so we have m LSP and we're going to add a keyword length you don't really have to worry about that you can find if you visit the CMP GitHub you can find all the available configurations that you can use and let's add all of the other sources we have the signature help we have NVM Lua we have PA I know we have buffer and we have the v-snip and again for some of them I'm going to configure the keyword length and let's add it to the buffer as well and also let's have a comma and for the NVM Lu I will also configure the keyword length what we have done so far we have configured how we will show the code suggestions we have configured the sources for nvmcmp so that it can find suggestions now we also need to control the plugin so for instance whenever we have a suggestion we need to navigate or switch amongst the suggestions and we can do that by using mappings mappings is where all the fun in neovium begins mappings allows us to create keyboard shortcuts for executing commands so in the case of the code suggestion dialog we want to select uh suggestion we want to move to the next selection for instance without grabbing the mouse adding mappings is pretty easy it can look a little bit scary the first time you do it but let's go ahead and see how we can add them keyboard shortcuts to execute commands inside the plugin here we're going to add a mapping object which will apply the mappings that we create to the code suggestion tab to show you guys what this is I'm only going to create one first and then we will add a few after we've tried it so to specify a mapping we add the brackets and inside the brackets we put the keys that we will press to trigger a command so inside here we will put our keys so we want to bring the code suggestions up for instance when I press Ctrl space I want the pop-up to appear so I'm going to go ahead and do capital c remember Capital C is short for control and Then followed by space you can just print space like that and it will understand and when we do that I want to trigger CMP mapping complete and doing this will trigger the pop-up to appear okay it's going to go ahead and add a small comment to bring up the code completion at current cursor so once we've added this control dot space shortcut we can go ahead and type shift colon explore because before our code completion will work we need to go into init.lure and we will have to require the code completion script so let's go ahead and add that and press Escape shift right and then shift colon queue to exit now I'm gonna go ahead and open the main go file again so it actually complained a little bit inside my file so let's go ahead and see if I can track that down right my bad we need to add a colon here so add a colon after the configuration or otherwise it's not proper properly configured so go ahead add that I'm gonna go ahead and save the file I'm gonna quit then I'm going to open main again and this time whenever I press insert I'm going to write font Dot and as you can see we're now getting code suggestions we are getting these suggestions like and I'm if I'm here I do font dot p i can press Ctrl space and it opens up this menu but I can't navigate inside of the plugin yet I can probably use my mouse but it doesn't really work as we want it and this is because we haven't configured the navigation inside the plugin yet so let's go ahead and add a few mappings we need more mappings so let's exit this file let's open up code completion again and inside mappings I will add a few mappings that I find necessary and nice to have so for instance whenever we press shift.tab we want to go to the previous suggested item Maybe and at this time I'm just going to go down to the configuration that we already have press YY up two steps and then P to insert it and I'm going to change here and do capital S for shift and then tab so shift tab goes to the next item and we're going to change we don't we don't want to call the complete we want to do select previous item so that's how we add more mappings so I'm going to go ahead and add a few of them so tab to go to the next next item for instance again I'm just going to go ahead and copy the ones we have so instead of shift tab I want tab and not the previous item but the next item let's have control e to exit the suggestion if we don't want to have any suggestions we can press Ctrl e to exit yyp to copy and I'm going to go ahead and do at this location Ctrl e but instead of complete I will do close so let's add a comment explaining Control Plus e closes this suggestion tab now this next part is really interesting because we want to select the suggested item and when we do we want to have the plugin add the code that we have selected so if I select a function as suggested I want it to insert that into the file and I want to do that whenever I press enter so pressing enter will return will confirm and apply so we need to add the setting and the key for that is CR CR is something that you will probably find in a lot of mappings and CR stands for enter or return and we're going to call the confirm function and we're going to pass in a function and inside of this we will do a there's something called a behavior you can find out more about this by going to the documentation but I've read it so I know that we have something called a confirm Behavior behavior and we can call it insert which will make it insert the selected item into the file and select equals true to make it happen uh if we only selected it so let's go ahead and save the file now we have added a bunch of stuff so shift tab tab control space control e so let's go ahead save the file shift colon quit to exit let's open up the main file again so we have an error at code completion Lua line 30. so I'm just going to go ahead open code completion type shift colon as the command and we're going to insert 30 which will take the cursor to line 30. this line is acting up so why is this line acting up C do we have any errors ah my bad so whenever we're doing this we don't want to seam the mapping we want to do CMP mapping that's really important so let's go ahead change that to CMP let's write the file let's go quit let's open up main.go again and this time C font Dot print and this time I can press tab to navigate inside and I can press shift tab to go back and Ctrl E I can exit and whenever I select something so let's go ahead and do a print line it also Imports for us now because that's one of the features that is added so let's go ahead and said fixed code suggestions which is amazing so enter test is still not declared and it's going to complain but our code suggestion is actually working and we can select and it inserts the selection that we have which is really nice it does look a little bit bad to be honest so far as you can see it's the description is kind of printed at the same location it doesn't look really good but we can configure this we can we can make this look a little bit better we can for instance go explore and I'm gonna go inside the Lua file I'm gonna go inside the configuration I'm going to add a new configuration window for styling for instance so the window command takes in a few suggestions a few options which we can use to make it look at least a little bit better for now we will fix more sooner so let's do window and we can do completion CMP config window border because we want to add a border to the completion window the documentation window we also want to have a border so let's add the same function to that this will make our code completion Windows have borders which really is a probably something that will make it a little bit nicer so let's take a look let's save this file and let's explore now we actually have to quit and let's quit let's quit that let's open up the main file again and let's see how it looks now when we added some borders so font dot print and as you can see it looks a lot better already using those borders now we can style this even more to sometimes if you have multiple sources and you want to know which source everything comes from for instance you can add icons which makes it a lot more easier to see which source has suggested what so let's go ahead and do formatting and we're going to add the fields that we want to format it's going to be we're going to want to format menu something called ever and also the kind so these are the items that we will apply to and we're going to have a function which accepts the entry and the item and we're going to do we're going to add some icons so menu icons you can find out how to do this in the documentation again they have examples of this I'm not I wouldn't be able to do this without having to read the documentation first so you know kind of always a good idea to read the documentation to see what you can change and what you can modify in each plugin and I'm just going to add some icons whenever we see if we have B snip for instance we want one icon but if it's from neoviem LSP I want another icon we're just going to add that and the idea is just to show um so let's see let's just whenever it's the buffer let's add a b when's the path let's add a p just make it really easy then the item the format function accepts an item and the item is what's being printed so let's do item dot menu let's apply the menu icon and entry Source name we have a map with the names of the sources these ones have to match the name of the source so as you can see here I actually made a typo it should be v-snip and whenever we get an entry we will check the name of the source which will be then grabbing the icon from this list and we will return the item and let's print a end to this function and let's also end that we have added a few menu icons so let's go ahead let's write the file let's close it let's open main.go again and let's see we should see that it now prints you can see the icon that is being printed in the suggestion which makes it look I mean a little bit better so you can see the disc one comes from the buffer so it shows us that it's B from the buffer and the other suggestions are from the LSP so it can help you understand what the suggestion comes from which can be nice it is it the current file or is it from LSP so up until now we have been using the explore command to move around inside of the files and I'm going to be honest I don't like it now there's a lot of popular plugins to handle this and I will show you one called NVM tree and I will put a link in the description and installing it should be really a breeze for you now so let's go inside Lua let's open up the plugins folder when we execute use we can actually add more stuff to this place than simply the name so let's go ahead let's add a name of the plugin which is NVM tree.lure now sometimes you will see sub requirements so what we're saying is that to run this plugin we will require another plugin and the plugin we will require is nvm3 slash nvim web debit cards now this plugin is actually optional so you can go ahead and skip it if you don't want it it will add small cute icons to the nav bar that we will be adding and installing it will require you to have a patched font so if you don't know what that is I suggest that you if you open up your browser you go to www .nerdfonts.com and nerdfunds.com is actually icons that are used for development and they have examples they have for example down here you have a font Patcher which allows you to easily install and Patch fonts uh and you need fonts to have this plugin show you icons um it's really easy to install you can press the download and you have a lot of fonts to decide on and they look a little bit different depending on which package you choose but I recommend using the font Patcher which makes it really easy to have patched fonts I won't cover exactly how you install that in this tutorial if you have that installed you can use the dev icons plugin otherwise you can skip it if we have added that we can go ahead and write the file and reload it using the Lua file command and then of course we need to run packersync which will download and install the plugin that's and this is cool because during Wild record while recording this tutorial we can see that the Mason has been updated and we can see what has been updated also so let's go ahead we have installed the plugin for the file explorer I'm gonna go ahead I'm gonna use the Explorer one final time inside it I'm going to create a new configuration file I'm going to call it file explorer.lure and the first thing that we will need to do is disable the regular net rewriter directory Explorer and this is actually something that they do recommend in the in the NVM tree GitHub they say that this is the first thing that you should be doing if you're using the plugin disable the regular plugin so we're just going to go ahead and do that using vimg loaded net read writer I'm going to enable something called term GUI colors because that makes it look a little bit better and we're going to require the plugin so this is the same as the other plugins that we have been adding we require the plugin and we execute the setup function now this time I'm actually not going to use the defaults I'm going to add a few options I want the exploratory to open on Startup so whenever we start neovim I want it to open up also I want to add a option called buffer ignore on setup and set that to true for now so once we added this we can go ahead press Escape save the file go inside of the init lure because we need to add or require the configuration file that we just created and we call that file explorer so I'm gonna go ahead and add it I'm going to go ahead and add it at the top because I want it to load the new beam tree in the beginning so it can disable net net right so it can disable the regular Explorer right from the start I'm going to go ahead and press Escape I'm going to save this file and I'm going to quit nearby and now the next time I open neovim we will see a navigation tree so you can see an icon for showing you that this is a Lua file and you can see a small X this is because I'm inside a GitHub repository right now and it detects that and shows you the icon it's showing me that we have modified or removed some of the files so the new vm3 is actually really really really nice and you can navigate between the files by clicking in there a tree file here to navigate between the tree and the text file you can either use the mouse by clicking but you can also use control W and then press the arrow key to the towards the window which you want to move which is useful if you have many of these tabs open which can happen or you can press Ctrl and double tap W and it will move to the next current open tab as you can see my cursor jumps between there's a few things you can do inside the MVM tree for instance we can press a which will open up a prompt to create a new file and I'm going to call it new file.go and once that's created I can press capital i and I will see the file here the reason why I have to press capital I is because by default nvmtree will hide files that are not inside of your git Repository so unless these files are added to the MVM tree they won't show up you can disable that if you don't want it I kinda like it to have all my git ignored files not show unless I specifically specifically tell it to so shift I to remove or show hidden git files now in my case I don't want the new file.go so I'm just going to go ahead and press d to open up the prompt to remove the file now this makes handling files inside of neovim a lot easier and I really like that so we can either press Q to remove the tree or we can use the command provided by mvmtree called nvim tree toggle which will open up or close the neovim tree but running a command like that or it's not really nice is it that's a lot of work to open up a simple tree so I'm just gonna go ahead open up the MVM Tree by calling the toggle command inside the Lua folder I'm going to press a to open the prompt to create a file now I'm going to call it costume keys.lure and inside this file I'm going to open it inside this file I'm going to fetch the key map function which is used to create new key mappings so I'm gonna do vim.api to find the NVM API set key map which is a function I press tab to select it with map I can create new key mappings and with key mappings we can execute commands the same as we did inside the mapping for the plugin but we can create them globally also and I want a global command and let's see map the key n to run the command and vimtree because that's what I want to do whenever I press N I want to toggle the navigation tree so the First Command here the first input to map is going to be n but this is not the key M this is referencing normal mode and normal mode is when we're not insert inside the insert mode so if I press Escape I'm inside normal mode if I press I I'm seeing inside insert mode there's also visual mode we haven't covered yet now we want the command to only execute when we're in normal mode and I want it to trigger whenever I press the N key and I want the command to trigger to be nvim tree toggle but I will also add the key CR and the reason to add CR is because otherwise we will only open up the command tab with the command pre-filled but we will have to press enter to execute it and I kind of want it to execute by default so adding CR will make the command also execute and I'm going to pass in the final argument which we can skip for now and once I've done this I'm gonna go ahead and save the file now regarding the NVM API you can find in the documentation what's available there's a lot available which you can do but setting the key Maps is really important to know so that's why we're covering it before we can use this of course I'm going to switch to the tree again I'm going to navigate upwards I'm going to go inside initial and I'm going to add the costume keys because we need to import the plugin so costume keys script I want to add so let's go ahead and save that file and let's do a final command which is QA now QA stands for quit a stands for all because if you simply press Q it will only close one of the tabs but pressing QA will close all of the tabs which is useful so go ahead and open nvme again now the tab opens and the navigation tree opens as expect if I press n now it's going to close and I can press n to bring it up great this is really nice this is a lot nicer to work with and will speed up navigating between the files a lot now you can resize it if you want to by simply dragging on the border and dragging it into the size that you want great we can now have a navigation tree and we know how to create custom key mappings which is really useful so I don't know about you but constantly pressing or writing the command W to save the file is kind of annoying so I'm going to add a second mapping which is Control Plus s to save the file and it's going to execute while in normal mode and we're going to do n to say normal mode when in normal mode we want to press c c capital c for control and Then followed by an S to save the file then we want to execute the command which is right and then we want to also press enter to actually have it automatically trigger and then we want to pass in the final parameter we're going to save this file we're going to quit all and then I'm going to open neovium again open any random file I'm going to remove the space here and then I'm going to press Ctrl s and as you can see the buffer was written that's a lot easier than having to run the command now hopefully you understand adding these key mappings is really what's going to make any of him super useful because using this we can add whatever command we want and it's really really helpful and you're going to probably be adding a lot of these ones we have a file tree we have code completion we have a language server which tells us what is wrong we know how to bind keys to special mappings I think it's time that we add a debug adapter and adding a debug adapter can be done using Mason as before so since in this example I'm using delve I'm just going to go ahead and install delve and it's as easy as typing Mason install delve I'm not going to show you how to find that delve is available because you should by now be able to use the language filter so once delve is installed we need to attach delve and to attach delve we're going to use a plugin called nvme dap so again let's go ahead and open up plugins.lure down here in the bottom I'm going to go insert a new row and we're going to use a plugin by m fusnergernos something I can't pronounce that M first and your M Foos integer and he has a plugin called nvimdap for supporting debug adapters and using these plugins will allow us to kind of support debuggers for multiple languages so let's go ahead do Command right or control s now so we're going to reload the Lua file so again shift colon lower file percentage sign to reload and then colon Packer sync to install so we installed the nvimdap now the same thing as always we need to create a configuration for the plugin so I'm going to jump to the file tree I'm going to press a and I'm going to add a file called debugging dot lure and I'm going to open debugging.lure and we need to specify which adapter to use so I'm going to begin by fetching the plugin fetch the depth plugin and to do that we will create a variable called dap and we will require dap so this allows us to use the DAP and configure it and we will add delve to debug so dap.adapters dot delve and whichever adapter you use it will be the same it will be dap dot adapter dot the name of the adapter and you can find more information on their GitHub and each adapter has their own specific configuration which you will need to apply but it's all documented on the GitHub so if you want to install another adapter I'll put a link in the description just go there and check out the adapter so delve is going to be ran as a server and we're going to need to bind a port to that so we can connect to that port and we're going to use a parameter we will see soon how we can fix that let's go ahead and do a executable and executable is going to be command equals delt oop like that delve and we're going to pass in some arguments these are pretty much always the same depending on where you want to connect so we're going to connect the DAP to the to the URL of my local IP because I'm developing on my local machine and you could change this to a remote machine if if needed oh I made a big type of supposed to be like that I'm not used to this computer that's why I'm misspelling a lot so we say here that we're passing the arguments dap we're passing the L flag and the local host and the port parameter as arguments we have configured the DAP we can add even more so we can add if you're familiar with Visual Studio code you can have different debug programs basically which you can add parameters or environment variables to basically to modify the debugger or the way you run the go program and we're going to add those and they are called configurations in this case and these configurations are going to apply to go so configuration.go so it's each time we're inside a go program area and run the debugger we are going to have these options available and here we can specify different types that we want to run when we debug so we can specify the type which is delve we can say the name of the execution is called debug for instance and I mean this could be basically anything the name it could be debug with no environment variables for instance and the request type is in our case going to be launch and basically what you put here depends on the program that you're going to run the debugger and you'll have to look at the documentations to understand and know what you need to add for go go Lang program this just kind of works unless you want to add or change anything so I'm going to go ahead this is going to run the current file so we pass in file as an example so this configuration will run delve it will run on the current file and we can add stuff for debugging test files for instance if we need to debug tests in go we can also add a configuration for that and we can do the same thing here we run delve we name it debug tests for instance and we say it's a launch request and the mode is test and the program will again be the current file once we have these configurations we can attach the adapter and we have a fruit a few launch configurations I hope that makes sense and let's add a comment launch configurations so let's go ahead we need to save this file Ctrl oh sorry exit insert mode Ctrl s and then as always we need to also update init.lure because we need to require the file require debugging and we will go ahead and save and we will exit and we will open up main.go and see so an error again at line four I'm just going to go ahead and open debugging and see why debugging line four oh found it at this location we also need to close the arguments I'm going to go ahead and write quit all open main.go again now nvme dap doesn't come with any preset mappings or anything so it's a pain to use in the beginning but we will fix this soon so to set up break point we need to run a command so I'm going to run a command called it's a Lua command and we will require dap you can do this to run Lua inside and we're going to toggle breakpoint and once we do that you can see a b up here this is a icon for a break point so we do have a breakpoint set now I'm going to run a command again and this time I'm going to run Lua require the plugin dap and then continue which will execute the and start up the debugger now you can see our configurations here we have debug and debug tests in our case we want to run number one debug regular and you can see that it failed to launch we actually have a error here so I'm going to go ahead and remove that remove the variable I'm going to go ahead and save the file and I'm going to rerun the debugger so open command Tab and press Arrow up to rerun the old command when running it again this time I'm running number one and as you can see the B is now replaced with an arrow indicating that we are currently here the debugger is at this location at this point we want to see information about what we're doing we can do lower require we can require the DAP and then we can go ahead and open a ripple and call open on it and we will get the debug tab opening up so if you go down using Ctrl W and then you go to insert mode it will add a new tab it will add a new row here and wait for your commands and you can do dot Scopes and it will say locals and we have no local Scopes in this code I guess we could go ahead and add some variable again and it would show debugging like this is not going to cut it of course so I'm going to go ahead and exit and I'm going to exit this program and I'm going to exit everything I'm going to open new VM again and I'm going to add a few commands so let's go into costume keys I'm going to create a new mapping and beam key m-beam dap key mappings so for instance we don't want to execute a command to start a debugger I'm going to make it so whenever I press F5 We Run The debugger when I press F5 I want to run the same command that we just did so Lua require dap dot continue oh sorry Dot continue and then press enter and then the command is done and let's finish that I also want to make sure that control plus b sets a break point so I'm going to add I mean inside normal mode I want control and B to execute the command require D dap dot toggle breakpoint and then we also again want to do CR to execute it and then the final param and let's go ahead and save this file now starting and starting the debugger and setting breakpoints should be a lot easier we will need some more mappings because when we debug we will need to step through we will need to step over step into for instance I'm just going to speed up and write them down here and add the comments as I go and I'm going to show you some nice things that we will cover so we can do press control plus I to set log point if you're unfamiliar with log points they're basically break points but instead they simply print something to the console to stand it out so I'm just going to go go ahead and do whenever we press control and L I'm gonna make it trigger a Lua require dap Lua require dap and we also need to make sure to have that command exit and we're going to go set breakpoint and we're going to pass in nil nil and then this third parameter is going to be Vim function input which will allow us to insert a message and we want to have a small prompt so message log Point message and we will exit the set breakpoint function and then we'll want to execute it and let's break that and the files so we can press Ctrl l to set log points which is amazing and we're going to add pressing F10 press F10 to step over a function for instance and I'm just going going to go ahead and add them F10 and whenever we call that we're going to do Lua require tap step over you say function so let's call that and let's close the command like that we will do the same thing for step into and step out to so I'm just going to go ahead and press YY PP and I'm going to go ahead and change these to f11 and F12 I'm going to change the function that is called so f11 will be step into instead and F12 will be step out and I see I made a typo so it's going to be step not set so step in step in two and step over now that looks a lot better and let's see we need to open Ripple we don't want to type Ripple open each time we want to see the debug information so let's go ahead oh I'm gonna exit insert mode yyp e and I'm going to have that on F6 whenever I press F6 I want to call the function Ripple dot open and I wanted to execute and basically that's it so I'm gonna add one final mapping so copy again go ahead and change this and I'm going to change it to DL this is something that I do you can set your mappings to however you want them well DL for me is going to rerun the last debugger so if I ran a debug and I may change this and I save the file and I want to run the same debugger again I can press DL to re-trigger it and you can do that using run last so I'm just gonna go ahead save this file with these mappings once we've done that we can close all I'm going to open up the main file that I have again and this time I'm going to show you that if we do VAR value and let's do value equals 10. and I'm going to say fmt print line value then I'm gonna go ahead and let's fix that I'm gonna go ahead and press Ctrl B to add a breakpoint which we just set I'm gonna press F5 and I'm gonna run the first configuration and we can see the debugger stopped at the line indicated by the arrow and we can press F6 to open up the Ripple and I'm gonna go there and I'm going to enter insert mode and I'm going to dot Scopes and we will see the value being printed so the value is 10 at the current location and we can go ahead and debug stuff from here there's a bunch of stuff you can do I'm not going to cover the rebel but you can do delve help if you want more information about what you can do but let's exit we don't want to debug this way anyways we're going to improve this more so I'm gonna go ahead and close all and we have a debugger and debugging this way kind of works we have the functionality to set the debugger we can step in step over and do those regular stuff but I like having a UI I like having a URL while ID bug so I can see what's going on easily now this is actually really really easy to add so again open up new of him open up the plugins going to add another plugin and we're going to add a plugin called dap UI and we're going to import it this time using a object again and we're going to name the plugin which is R cariga NVM dap UI and that plugin has a dependency and it depends on the plugin that we used to debug because without the debugger we cannot have a UI so add that and I'm gonna fix string ending like that so and I'm just going to correct this as well I don't know why I did double doubles so let's add that let's save the file let's do a Lua reload and let's do a packer sync to download the UI okay we're done and then we're going to go into the debugging file again I'm going to open it and at this location at the top I'm going to add a new import so set up dap UI we're going to require it same as with the others so so required dap UI and we're going to uh basically we're going to use the defaults so dap ui.setup which will trigger the default configurations so I'm going to go ahead and save that by default dap UI has a toggle function that brings up the UI while we debug but this will break our current layout with n-beam tree if we bring up that UI our neovium tree will still be there and I feel that we don't need the navigation while we debug so I'm gonna go ahead and change the key mapping and this is one of the fun Parts about neovium we can do I can make it do what I want now I'm gonna say that whenever I press Ctrl plus d I will toggle debug mode and remove NVM tree because it's in the way when we debug so make a new map and again I want this to be in the normal mode and I want it to trigger when I press Ctrl d and when I do I want to do nvme tree toggle I want to execute that function but I want to continue call another function which is required dap UI dot toggle and then execute that function and then go ahead and close this and like that so before we save this I need to correct that we need to add the closing so it's Ctrl d I'm going to save this file I'm going to go ahead and close it open up the main.go again I'm going to place a breakpoint by Ctrl B now I'm going to run it pressing F5 to enter which configuration and I see by the arrow that it's running and now I'm pressing Ctrl d and as you can see it brings up the debugger information the DAP UI and it's a lot nicer we can see the scoped values and we can see the information we can see the stack Trace and go routines running and we have the rebel window down here and it removed the NVM tree which is nice because we don't need it while debugging so this is nice but one other nice thing about neovim is that you can make it reactive so as you Traverse the bottomless pit that neovium is and you will find many things that you might want to do and one thing that is great to know is that there are something called events now both neovim triggers events and plugins also triggers events now just as in JavaScript we can subscribe or listen to these events and apply commands to trigger whenever we see them so as a lesson I want to make it so the DAP UI appears whenever I start a debugger now we could simply make and change the FM command to actually run dap UI but let's trigger it on the event from the nvme dab plugin now neovimdap triggers two events the before event and after event event and you can find more information about these in their documentation but I'm gonna add a listener to these events so let's go ahead and do nvim and let's open up the debugging file and I'm going to add my event listeners here because they're related to the debugging depth fires events before and after trigger dap UI when we see them that should be clear right so to do this we can do we specify the plugin and we access the listeners and then the name of the event in this case it's going to be after and then the event initialized and it's going to be dap UI config so whenever this happens we're going to execute this function and what we want to do is we want to open dab UI and we have already imported dap UI here so we can access that UI by simply doing dap UI dot open and then we want to end the function and this will make it so that the DAP UI opens up whenever the DAP plugin has the event initialized event triggered I'm going to go ahead and do the same thing for the before and instead of event initialized I'm going to do event terminated terminate that because we want to close the UI whenever nvmdap plugin is shut down so let's go ahead and do an end and at this place we want to do web UI Dot close so whenever the event that the dab is terminated we want to close the UI and one more thing is event exited if it finishes we also want to close it so let's go ahead and add that and hopefully you see here how easy it is to chain these things together and making the editor really go ahead and become the way we want it so we have added the event listeners I'm just going to go ahead save the file exit it go inside NVM set the breakpoint Press F5 open the configuration and this time you will see it ran the DAP UI now it did not remove the new beam tree because we didn't tell it to but if you want to you can go ahead and add that as an exercise you can also try pressing n because remember that those we still have the shortcuts we can still these are just new tabs that opens and we can manage and control them the same way as everything else so go ahead and try adding so the new beam tree doesn't open up for you whenever the DAP is Ran So let's be honest what we have done so far is powerful and flexible as hell we can make it look and do whatever we want but it still looks like crap so to make new beam look a little bit better we can have color schemes which modifies how neurium looks changing the color scheme will basically it's a lot of colors you can change and you can modify that however you want and I'm not much for styling I'm I have a really crappy eye I'm colorblind so it doesn't really help but one cool theme that's really popular is the Dracula theme and you can actually make neoviem look really good by just importing that plugin which will modify the color scheme for you so I'm just going to go ahead and show you how to and it's the same as always it's the three-step rocket update plugger add a configuration file require it in the init.lua and you're good to go so let's go ahead we're going to add and it's more fecal slash dracula.nvim so once we've added that save the file reload the Lua file and then oops forgot to close the string then save the file reload the Lua file and then Packer sync which will download Dracula for us and then we're going to configure it I'm going to go to the tree add a new file called styling.lure and I'm going to open styling.lure up and we're going to apply the color scheme that is Dracula and the way to do this is we type vim.cmd and it doesn't matter if you download Dracula or any other color scheme this is the way you apply it you do veeam.cmd color scheme and then the name of the downloaded color scheme so if you have multiple ones you can switch them out by changing the Dracula here to the name of the theme that you have found so save the file and then the last step we need to require it so that new Vim knows that it should apply the settings so let's require styling let's go ahead and save this and then close it and whenever we reload it's going to look a little bit different and it's just gonna look a lot nicer and I like this styling a lot more Dracula looks great out of the box and hopefully hopefully you think so as well so that's how easy it is to apply a new color scheme there's a lot of them out there but I mean Dracula is nice enough for me we're gonna apply some quick development tools to just make it a little bit nicer and there's a tool called tree sitter which is used to make more advanced code highlighting and better code highlighting basically and at this point you should really know what's going on when we add stuff um so I'm just going to speed up a little bit and add and showcase some of the really cool plugins that are available so I'm gonna go ahead and make a new requirement here or a use here and we will download and use something called nvim tree sitter which I really recommend it's a really nice plugin tree sitter where actually when this plugin runs we're actually going to have a custom function and we're going to end it and this is from their this is from the plugins GitHub they do recommend you to do this uh I really don't know to be honest why there was something some kind of bug that could be could be happening if you don't do it this way so we're going to do local TS update required to plug in and do update and we're going to pass in a object and it's going to have the field with sync set to equals true and then we're going to call and execute that function which we just created we are requiring the plugin and vim3sitter and let's go ahead let's save this file and let's reload the Lua file and something is wrong no so the thing that was wrong is I forgot a colon so let's go ahead and add that save the file lure reload and then Packer sync to install it so it installed three-seater for us I'm gonna go ahead and close that I'm going to jump to my configurations file create a new file which will be syntax highlight highlight.lure I'm going to open it up and we're going to configure the highlighter so I'm going to require the three-seater configs and I'm going to execute setup we have to specify the parsers to use and I want to use three-seater whenever I am handling go files or Lua files or rust files for instance and we want to sync installation false and I will Auto install any tools needed so and we want to enable highlighting of the code so enable equals true and before we save the file we need to add these columns here so we don't have any syntax errors otherwise neoving will complain once we added the commas we also need to go up to the top and replace it should be nvm3seater dot configs that we set up so save the file go into init Lua import the file and by now you should you should really know the steps always the same three steps so syntax highlights the and let's go ahead save the file let's open up main.go and you will see that it starts downloading the three-seater for go because we set it to Auto install and I'm getting some errors probably because I have them installed since before and the three sealer for rust has been installed one has failed I'm just going to go ahead and restart it and as you can see the syntax highlighting now actually highlights the function names and everything looks a lot better so three-seater is really amazing for that advanced syntax highlighting and I do recommend it so we have a nice looking it's starting to look really good actually so I'm going to go ahead and go into plugins again I'm going to go to the bottom and I'm actually going to add a new plugin and the same thing here I'm going to add a configuration and we're going to add telescope telescope is really amazing and it allows you to search for files using grip for file names or even inside files so I'm gonna go ahead and require the plenary as a requirement and you can find the configuration for and how to install it in the GitHub all the plugins will have a link in the description but we need these two so let's go ahead let's save it let's reload the Lua file let's do a packer sync it should install the plugins and once that done again we need to add a configuration for them I'm going to add a file called file finder.lure I'm actually quickly going to jump to the costume keys and inside the custom keys at the top I'm actually going to add a comment change leader key now the leader key is a key that you can use to start commands and in my case I'm going to assign the leader key to uh to comma so I'm going to do vim.g map leader and I'm going to set it to comma so whenever I press comma it is known as the leader so I'm going to save that now I'm going to go back to the file finder and in here we will add key mappings that execute the file the telescope plugin and there's a few things that you need to know about the telescope one of them is so you do need rip grip install to properly use telescope it's really simple to install basically there's a installation instructions under GitHub pause the video install it and I'm on Ubuntu for example it's simple as up get install rip grip rip grip is really amazing you should install it once you have rip grip it's time to start key mapping the telescope we're going to add a the ability to search for files and one thing about telescope is that it actually respects your git ignore and I'm inside a git repository right now I have my DOT files here I'm going to go ahead and do key dot map key map set is a function this is another way of setting your key maps previously we imported the function but we can also call it right away so we're going to use the newly assigned leader plus FF which will bring up telescope so we can search now to do that we're going to call Lua require telescope.built in there is other ways to execute this you could require built-in as a variable and call it call the function from there they do so on GitHub the reason why I'm not doing it is because actually configuring becomes a lot more code simply calling the function like this will allow us to configure the command straight in the Lua here so it's a little bit easier so I'm going to call the find files which will bring up the find file prompt I'm going to pass in some settings such as no ignore which will make it not follow and respect git ignore I don't want to follow git ignore in this case sometimes you do sometimes you don't if you have times when you want to search on hidden files for instance only and maybe not get ignore files you can change this command have it on another key mapping for instance it's all up to how you want to have it and we're going to execute the command we're not passing any options so it's just going to be like that we're also going to add live grip then we're also going to add a key mapping for live grip I'm just going to go ahead copy this because it's a lot to write and I'm going to change it so it's going to be leader if g g for grip we're going to change the function called to live grip and actually live grip doesn't accept these configurations I think it accepts hidden but it does not accept the no ignore so we're just going to call the function and execute it like this now at here in the top we also need to close the command like that so we have two new functions and before I save this file I need to change this to close the function so let's save the file and let's add it to any glue let's go inside any Lua and let's require the file finder script let's save this and let's quit once we've done that we can open new Vim again I'm going to press my leader key which is comma comma FF and it will open up the find file search as you can see I can see my files here now it's super fast to search for stuff and as you can see it's really just kind of nice to have when you're searching for Stuff now if I open up rip grip it's not going to show anything and that's because in my case I have git ignored all the files inside of my homefolder.config and I kind of get added the ones I want to save in my repository I know it's strange that I have a git repository here sorry about the confusion but we can I can show you how fast rip grip is by going up a few steps I'm not in my git repository anymore I'm going to execute neovim and I'm gonna open the rip grip and rip grip uses fuzzy searching and whatever you search for it's just going to be super fast so let's see if I search for go for instance you're gonna see it finds a million files but it's still super fast so if rip grip is really recommended so before we end things I just want to show you one final plugin so I'm going to go back to my DOT config neovim I'm going to clear my screen and I'm going to open up neovim again I'm going to go inside my plugins folder and I'm going to go page down to jump to the bottom and I'm gonna go ahead and add a status bar which is kind of nice to have when you code sometimes it shows you the GitHub status of the repository what branch you are in and a little bit more so I'm gonna call you something called NVM Lua line and luoline NVM it will also have a dependency to the dev icons and if you didn't download them before I really recommend you to do so because they make it look a lot better and I'm gonna set it at as an optional so once we have added the lure line let's go ahead let's save the file let's reload Lua file and let's add a comma I always forget the commas so let's go ahead save the file reload Lua and then let's go ahead and execute Packer sync to download the luolime plugin and once once that is downloaded oh a lot of updates so once that is downloaded I'm gonna go ahead create a new file and I'm going to call it status bar.lure I'm going to open it and for this tutorial we're simply going to use the defaults so I'm just going to require it and call the setup function so that is executed I'm going to save that file I'm going to go inside init Lua and I'm going to add the requirement now how you structure your files is up to you you don't have to have as many files as me I like making a file per plugin basically or kind of area like the debugging file it contains all the plugins related to debugging it depends and it's up to you how you want to structure that some people have like one giant file and like that I like having many small files I find it easier for me to understand what is going on so once we require that I'm just going to go ahead and quit all and open new Vim again and you will see that we now have this nice looking kind of bar which shows us some information about I'm on the master Branch I have a few changes and a little bit of information about the file and that's really nice by now I think you understand how you configure and use neovim there's a ton of things to learn but we could go on installing plugins together forever but I think it's time to kind of let you go and have you learn and practice some by yourself there is a bunch of plugins that I can recommend so I went ahead and reset my neovim to my regular configurations just to show you a few plugins that I can really recommend so the first one I want to recommend is something called Auto Pairs and basically it's as simple as whenever you create a single bracket it will create the counterpart for you just kind of a nice to have util when you code because you will always probably want pairs so Auto pairs does that for you now I also have something called a buffer line and as you can see at the top here it shows me my current open buffers so I can navigate easily between them also I have something called indent backline which is basically just for showing me the indentations of the code it can be really nice to see how many indents there is on each row and I can also really recommend float term which is this one which allows you to open up a terminal as a pop-up but more than that it allows you to open up a terminal with other programs running such as lazy git for instance if you want to have a git integration into the new them so if I go ahead and do leader G for example I open up a float term with lazy git running here I can see changes and control what's going on inside of my git Repository on my machine and one other thing that I really recommend as you can see I'm getting a few errors here because I'm running a linter and linters are really important and I love them so I can really recommend a plugin called NVM linter it allows you to set up as you can see here I have a linter for cargo and I can configure it I also have linters for golang and I can configure them and add many linters this way and it's really easy to just kind of have them running and what I have done here is that whenever I save a file it will run the linter for me I can really recommend NVM lint there's also a plugin called trouble which I can recommend now travel allows you to have a travel tab such as this one I can see the current errors inside of my file and it's just really handy and trouble also allows you to navigate using it so if I open up trouble again it brings me to the trouble and if there were multiple troubles here we could jump between them and that's really nice and as you can see here I have a to do which is highlighted and that is another thing that I really recommend to do highlights you can add different tags it doesn't have to be a to-do it can be a bug or a hack or a any other tag that is supported and one thing about that is that it is actually supported with telescope so not only can you add them to your code but you can also search for them inside of telescope so what I've done is that whenever I press my leader key and ft for instance it brings up this to do and I can search for to-do's here so it allows you to find to Do's using telescope as well remember that telescope respects getting more files so I won't see mine because I have git ignored it also I can recommend tag bar tag bar is what we see here it's a code overview basically you can see the main function you can see all your functions because it tags the code so you can really outline the code in a nice way and it makes it easy to navigate in large files because you can jump to them using this tag bar and I really recommend it we have learned how to use neovium there is of course much more to learn about neovim but I think that if you start using it daily you will kind of get to a point where you learn how to use it efficiently so far we have covered the most needed Basics and the needed knowledge to kind of get started using neovim you shouldn't have a problem using new Vim after this I think and you should be familiar with how to install plugins and I can really recommend you to go out there and search for plugins and hey even build your own plugins Maybe so after this tutorial I think we should be familiar with navigating neoviem using normal mode and insert mode you should be familiar with how you execute commands in vim and you should be familiar with how to add plugins and how to configure them and really handling plugins using Packer should basically be easy now I really do recommend you to look up how to set up linters and formatters and a hint is Mason kind of has support for this so it's a good tip now it will come as a good practice for you to install a few plugins on your own to make it really stick try setting up a linter maybe for your favorite language or kind of start configuring it to work for your favorite language all of the plugins that we have covered are generic so they work for all the languages you just have to install the language server for instance there are often plugins in neovim which can help you set up things as well so for instance for an awesome go experience in neovim you can look up a repository called x-ray go which installs a ton of stuff for you that is just really nice to have when you develop using go in neovim the con of those packages though or that they often contact contain a lot of stuff and from my experience at least what I feel when I install them uh I have no idea what's going on I have no idea about the features to use the key mappings they add uh it's usually like kind of overwhelming and I like adding my own stuff uh as I as I need them and during my enduring while I work with it I kind of get these ideas like oh I need a key mapping to do this and I can add it as I go if you have trouble following this guide you can find my DOT files at my GitHub I will put a link to all the plugins that are used inside of the description here you can also find a written tutorial basically it's the same thing that we have done but in a written format on my blog as well if you like this video please feel free to like And subscribe my channel feel free to reach out to me if there's anything you're wondering about or if you want to say that you like my video or if you want to say that it sucked feel free please leave feedback so I can improve my channel in the future hopefully you feel comfortable with neomim and what can I say go out build yourself a dream editor I'm constantly changing mine try joining a community I'm using the neovim channel on Reddit a lot if people are super helpful and you don't have to feel any worries about asking questions we we've all been you I'm still kind of new to new of him and I'm just constantly learning learning and I hope you will as well take care and bye
Info
Channel: ProgrammingPercy
Views: 10,588
Rating: undefined out of 5
Keywords: how to setup neovim, how to install neovim on windows, how to install neovim, how to config neovim, neovim installation guide, neovim setup tutorial, neovim installation tutorial, neovim plugin tutorial, neovim config tutorial, neovim autocompletion tutorial, neovim linux setup, neovim config guide, neovim, open source, technology, editor, ide, vim, tutorial, neovim go, neovim golang, golang, go
Id: H0J1c48NObc
Channel Id: undefined
Length: 124min 15sec (7455 seconds)
Published: Thu Dec 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.