NvChad - neovim, treesitter, lspconfig, lint and conform - Archlinux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we'll be installing NV Chad which is a configuration of neovim in Arch Linux you would like to follow along with the instructions and I have a lot of extra useful information you can go to github.com programming rainbow and this one's going to be called Envy Chad and it's 2.5 because there is a breaking change between version 2 and 2.5 so this is the newer version this also assumes that you already have a terminal setup um which is pretty easy you probably already have a terminal set up but in the prior video we did set up the lacer terminal and a nerd font installed and we have jet brain's mono nerd font already installed so that was in a previous video but there isn't really too much you need before this one just a nerd font and some type of terminal so I kind of want to just show what this is going to look like I'm going to pull my own version down just to show what this is going to look like first and then we will actually back up and use their version this is going to show the very first boot up of this um so it's going to actually pull down everything it needs configure everything it needs up and running like it's the very first time you're running it so I'm going to make sure I remove local state inm and also local share and now we're going to start in vad for the first time and I'm I'm going to go inside the folder just so when it does start up that we can look around I'm just going to say in in and this is the very first time it's starting up there's no prior configuration going on I just pull down what we're going to see at the end of this video so this is going to need to reconfigure itself from from the ground up now so if we just sit here and wait it's pulling down everything now it's setting up tree sitter and it should pull down three more Lua check um Style Style Lua and L Ls I'm just going to see if it's done I'm going to show Mason to see if the three expected files or packages are installed so I do have three packages installed and you'll notice that theme had already changed on its own the first package is an LSP package which is Lu LS and the next package is in linters and it's Lua check and the final package that's installed is in formatters and I'm just pressing the numbers I press two for LSP four for lter and five4 and this one is style Lua for the format okay so those three packages are already installed going to pull down what you need automatically this is I've set this up so it's going to automate this process you ever went to another computer or you've messed up your config and you need to pull it down it's just going to set it all up to the way that it was already working and we'll just go look at the file real quick I'm just going to close this and I'm going to do it with Space X space being the leader key and now I'm going to use control n to open up the side here in Vim tree so if we just look at a file here say plugins in it this is where all the the main packages are configured the tree sitter is right here and it's saying tree sitter needs to be it needs to make sure that it is loaded before the buffer is red or before there's a new file create I've used this on several of them but uh several other ones on La and we'll talk about this later but I just want to show that things are actually working so let's say I changed the indentation right here I'm in normal mode now I was in insert mode I've gone back to normal mode and I've set it up so it's happening every time I save the file so if I hit um shift colon right now and I hit W down here it's going to save this file when it saves this file you're going to see that this part that I've removed the tab withd is going to retab in because that is how it should be in the style now that since this is the init Lua it's telling me that I should reload this we're not going to really worry about that right now kind of want to show us signature so I have this signature pop up this is basically telling me about this uh function right here this is part of the LSP so you down here you can see that the luor LS which is the Lua language server is loaded so this Lua language server that's what's running that's what's giving me access to go to definition and uh it can do autocompletes uh if I'm typing in code it can give me suggestions on what it thinks so these are all the things that the language server does and it also does things like it can do formatting as well depending on the language server it might it might also have that and it might also have linting um where this one does have linting but I'm for this configuration I've shut it off and you'll see later on well right here I've told it to shut off Diagnostics which is actually the lenting that's because I'm actually using a different linter um I'm using Lu check instead and we'll talk about this so we're going to work through this step by step I just kind of wanted to show you around so the language server is definitely working the formatter is definit working and if we were to make a say a typo this is what the lunter would find so if I went like this right here and I'm in I'm in um insert mode and if I go back to normal mode it's going to automatically check when I flip back from insert mode to normal mode it's going to do a linting check and we're going to see an error there we go and if I hover over over it and if I they they've changed this now because uh this is part of a neovim 010 I believe where they've actually made the key combination part of neovim so so Envy chat has defaulted to the neovim version but it's going to be control W and then D and that's going to hover me basically what's said here sometimes it'll go off the screen it's going to give me a hover diagnostic right here of what's going on and this is actually coming from not the Lu language server but the lenter Lua check but if I would have enabled the other one it would have came from that one too so I would have had both ways also one more thing I just wanted to show a bit quick overview let's undo this I'm going to go into insert mode and back out that's going to be fine just to let the lenter recheck uh the other thing that you're seeing here is the coloring in these text okay this is actually done by a the highlighter this is a all controlled by tree sitter so most people already know about this but if you don't know about this the kind of the coloring is done by tree sitter highlighting okay so that's the that's the kind of four things that we're going to set up we're going to set up treesitter we're going to set up a formatter we're going to set up a linter and we're going to set up a language server and I want to make it set up so that when you add later for different language other than Lua that it'll be a simple and easy and I kind of want to go through all the the issues that I've had and understand in what's going on cuz a lot of it's kind of like feels like a magic black box and it it doesn't really make sense some people make it look really easy they know exactly what they're doing and then when I try to do it I find out that it's a way more complicated so again this is just a quick overview of what's going on we're going to break this down and and build it from the ground up and I'll kind of walk through each part step by step okay so I just want to show this is the end product of what we're going to have it's going to be set up just for Lua right now because it is configured in Lu it but um I'll do another video for different languages that will'll be adding on top of this one so if you're were developing for C or C++ or something else how you would add those language supports in okay so since we've seen this I want to tear this down now and start from the ground up from Envy Chad so to get out of here you could press Q or if you're in a file that hasn't been saved you can press WQ but you end up keep having a closeing so if you just p q a this is quit all which just gets you right out of there so now if you've already have a configuration so so I have this whole page set up here and read down it basically I'm saying if you already have an invm config and you don't want to lose it you might want to U Move it over to an old file okay so if you don't if you don't want to lose your old configuration you might want to move it and save it as another name somewhere okay I've put that up here just so that I'm going to go ahead and remove mine but I'm also remove this local state and local share this is stuff that is when it downloads things packages and it configures them and compiles or installs different things they go into these two folders here so this is where the config is these two folders are where things get downloaded to and put in or cached to so I'm going to remove all three of these and then we are going to start with first what packages we need installed let's just remove the packages first and then remove the those folders so I'm going to do an RM on this local share so that it's the tillary which is my my home folder and then local which is the hidden file share and then invm you don't need to back this up as another name you can just get rid of this and the there's another version that is State and then for for the one that you want to move this would be config invm if you care about this one you might want to move it to another file name let's say something like this I just put an old or whatever name that you want to use we can just do that real quick so that's actually gone this this directory I'm in shouldn't even exist anymore let's see if it does Okay cool so it's gone the whole thing's gone now okay so there are some packages we need if you followed my last video and you set up a laery and you and you have the it doesn't matter if you have fish set up or not bash is totally fine none of that really matters but as long as you have a terminal setup and you have a nerd font that's what you really need prior to this video so we're going to need neovim we are also going to need unzip I found that neovim uses unzip but unzip is not installed on the default Arc Linux installation and it's not installed on what I showed in my previous videos to install so we're definitely going to need that now since I'm using Lua Che which is something that they're not using by default in Envy Chad they're just using the Lua L LS server the Lua language server luor LS they're using that one specifically to do linting and it doesn't matter but since I'm using the other one for linting um we do need L rocks installed and then these other two here these are based on whether you're using x windows or Wayland if you're in x windows and you want to be able to copy and paste between mm and your environment or vice versa you're going to need xclip if you're in um x windows and you're going to need WL clipboard if you're in Wayland I believe you can just install both of them on your system without any issue so I'm going to go ahead and do that and I believe mine are already installed I've put the needed switch down here so it's just going to tell me it's installed and oh I didn't install this one that's fine okay so those are the kind of prerequisite packages that we need now we're going to be using an Envy Chad Envy Chad is just this is neovim if you don't know what neovim is neovim doio is the web page um NV chat is a preconfigured version of neovim it's got all the kind of goodies I really like how it's all set up and I didn't have to figure out how to do all that stuff some people that know exactly what they're doing can set up everything but but it's a little bit above me so all this kind of great stuff that where it's already kind of set up as a as an editor out of the box uh almost an IDE that's why we're using Envy Chad but there's other ones there's lunar Vim there's um some some other ones it's not really important to me I just want one that works so right now I've been using Envy Chad so that's the one I'm working so this is the page for Envy Chad and I believe do we have if we go to install it's going to tell us different instructions for installing this is the the one right here it's just a get clone and we're just we're just cloning the the GitHub Envy Chad starter the starter repository and we are putting it in config inm and then launching inm after it so this is they're assuming that you already have neovim installed and that you have unzip and other things needed we're not going to do this next step down here that says run install all this will basically tell Mason to install everything that it needs to install and sometimes you actually want to use packages that are on your system and not on Mesa so I'm not going to be doing this step and it says you can delete the git folder so it's not you know there and and down here it has uh the files that the folders that you should remove you know the config again if you have an old one you might want to change the name of it so you can bring it back and the second two ones don't really matter okay so I'm going to just take this this Command right here this is actually also in my this is in here as well and this page we're going to be looking at it so I'm I'm going to close this neovim here in the Envy Chad page now we're done with that but this this what they allude to is this starter this Envy Chad starter and the internal Envy Chad internal one we're going to be looking at both of these later so right here I'm going to use that command that they said okay so I'm just going to run that command that they had on the on the site that grabs the repository for Envy chab starter and it just copies it into your config invm and then it runs it so here it is get clone I just copied it straight from the web page and this is their Envy Chad starter and it's cloning it in directly into config invm so invm cannot exist when you run this command if you run this command it's going to complain that the folder already exists right now it does not exist and after it gets done cloning it the two Amper Sands this is a this is an and this says if the First Command completed successfully go ahead and do the second command so if this Command right here completes without an error then this second command will run that's what the two ampersands mean it's saying if the first one fails the second one will not run so the the invm will only run if this First Command uh completed successfully it looks like it did cuz it looks like we're getting now this looks a bit like what we saw in the beginning but it's not going to do the same thing this is going to give us just the stock and V Chad say tree sitter it's probably done now so to close this I'm going to use space X which is leader key and then close and then contrl n for the side oh we're not in our I'm just going to quit it and go into the folder we're not in the um configuration folder Okay so so right down here it's complaining about Lua language server is not installed now I'll just show it here in a second if I would have done this Mason install all and that's a capital m capital I capital A if I would do this it would actually while just do it and it'll it'll show it installing calua and them so you have to manually tell it to do that but again I don't like this because if I have a language server that is actually my uh package manager and they're they're trying to download one they don't work together sometimes sometimes the one on your system works correctly and the one that is coming from Mason doesn't work but you still want to configure it so Mason will say hey everything you're trying to configure I'm going to go ahead and download that I I don't want it to do that so we're not going to be doing that at the end I'm going to close this again and you know th this is a different um theme right here I think it's in here is it yeah so it's using one dark right now and it's in so right now the folder that we're in is the the hidden config folder in Vim that's where I'm that's what all of this is right now this is all inside there and we're we're looking in the Lua folder because all configurations done a Lu neovim that we're doing and inside of here there is a Chad RC now I'm not going to change anything in here but I can just tell you the theme right here gets changed so if I were to change the theme which it's leader you can see different options here that you can choose from after I press leader which is the space key um but t means that there's more to it so if I press T now I'm going to see telescope and vad themes There It Is I've set it to cap chain now if I were to reload this it should now say what it is so I think it's an Envy Chad now it says capucine and you'll see over here that it's xed out and you'll see lines here this is all because um git is here so it's basically saying I'm making changes to this um we don't need get so I could delete it in the command line but I can actually just delete it over here if I just press if I'm if I'm selected on it my cursor is on it I if I press D it'll say remove down here remove get yes and I can just remove it there so yeah so that's the theme I'm not going to change anything in this file at all I just wanted to show you where it is if you interested it's in chat RC I'm not going to do anything in this file I'm going to close this file I'm wondering what I did here so I'm going of close this restart it so yeah so I'm not changing anything in there let's let's go down and see what we're doing here we have set it up and I also put if you do want to grab my version real quick which will probably become out of date with their actual version at some point so maybe you shouldn't do it but you can you can just grab my version directly and that was what we saw in the very beginning of the so we're going to edit the options the reason why we're doing this is because right now they have it set up for uh well I'm going to show you where this is actually coming from we cloned this uh Envy Chad starter repository but there's an actual this actually references behind the scenes something else it it there's settings that they've set under the hood that um you don't really see and the way to see them is to look in a different repository to look in Chad um Envy Chad slnv Chad so that's on GitHub and this is going to actually show you kind of what it looks like under the hood what what's kind of hidden from you um so if we go into Lua in V Chad and we were to go into options I believe it is yeah these are the options that are set okay and I'm interested in right here in the indentation I do not like these two space indentations that's my personal preference I do not like that I just want everything to be B4 so I'm going to show you how to do that so that's the first thing that we're going to do so I'll just show you the same file over here um the one that we've basically downloaded right here in options this is the file so this is kind of the file you get to configure and this is the file that is being referenced under the hood so I want to change this I don't care about changing all of it I just want to change these twos right here to Fours that's the only thing I'm interested in so these are both both in the um Envy Chad but one's Envy Chad starter which is what you get when you um download it and the other one is what's happening under the hood the Envy Chad Envy Chad repository that's kind of where you can see where their defaults are what what's happening that that's kind of underneath what you see so that right now so if we go into this um config and Vim Lua options. Lua file for us which is right here this options file right here what I want to do is I I'm going to use this this right here it says add your code here right here this is commented out if I want to uncomment this I can press leader and then forward slash that uncommented it now it's it's telling me that it's not being used that's fine so what I'm doing is instead of me typing in vm. O do just like um what's in here oh sorry um they're using it as well they've set they've set o to Vim they've set a local local option to be vm. o as o so if you didn't do that you would actually need to type out the whole thing so yeah so I'm going to use that since it's already there they've already put it there for me I'm just going to uncomment it and use it so um what the changes I'm making is right here I've taken this to this and I'm just making these changes right here so I'm just going to copy that and put it in there oops I made a I made a pasting mistake I need to paste with um P because that's the how you paste in normal mode in new them or Vim or VI or anything so if I didn't want to use this above that I uncommented I would have to do it like this bm. right and you can also do it as opt as well this is a global and I'm just going to since that's the what I'm referencing that's what I'm changing I'm just going to keep it exactly the way it was so this is going to this is going to override those other settings and I'm just changing those twos to four and nothing else and I'll show you kind of where this is if we go into let's just go into here real quick see see how this is this is set to two spaces if I SP if I press tab right here I only get two space tab so if I press um leader f and then M I'll manually format and you saw how my my tab see my tab is way over so if I press leader FM it's going to format it it's using style Lua to format it I have to manually do it right now but I don't like that I I don't like any of this stuff this to two stab if you do like it just leave it you know you can um leave this option file alone you don't have to change this you just don't do this and it'll be on two but I'd like it to be four so I'm changing this to four so I'm going to save that now if we were to um so I'm going to do wqa just to close the lot and reopen it and I'm going to go back into that file that we were just in say this one yeah they changed is is how my tab is going to act so right now if I were to tab let's get rid of this tab and if I press tab I actually get four spaces but then if I go and put leader FM it switches it back so basically it's overriding what I have chosen and that's because conform is using sty so that's just basically changing what I want to happen I want my Tab Key to be four spaces and that is being changed now in the in options and it's not changing style Lua style Lua is just going to every time I format it's going to switch it back to two we're going to see that in a minute but anyway so if you wanted to change your tabs to spaces and make them for spaces this is how you do it they're set by default to two and that's what has been done here okay so now um as you saw style Lua is the is the one that's formatting for me it is still setting it to two so I want to change it to four and I also do not like how they remove the the uh parentheses parentheses okay I actually like to see the parenthesis I know it's it's a little bit more symbols to show but I it means at a glance I can see exactly what's going on I know exactly what a function call is so I am going to comment this one out and I'm going to change this to four and this again is is in their um this is their sty ala. tommo file this is right in the top level so if we go up here right in the top level here is our this is what style L is using and you can see the indentation is set to two right here so I'm going to set that to four and right here call parentheses this is for parentheses around function calls I'm going to comment this out so I'm going to go into normal mode and use leader forward and it's com going to comment it out so I didn't need to think about what kind of symbol I needed to use so I'm going to save this and then I will come back in and and now we can see if that changed things so now I'm not going to press tab or anything I'm just going to do the leader FM and see if it formats lader FM and see everything changed to four now okay so now every time I press tab I'm going to get four and then whenever I have a format which we're going to make it do automatically um FM it's going to fix it okay so right up here it says uncomment for format on Save now this is kind of right what this means is this event setup right here is buff WR pre this means before the buffer gets written to before you're saving it's not going to run the format or what it's going to do is load the format um conform conform is going to be loaded not actually run so if it wasn't loaded into memory yet it will now be loaded into memory that doesn't mean it's actually going to run what actually makes it run let's go into conform here it's in configs so we were in plugins um in it Lua that's what initializes the plugins conform is what's configuring it if you see down here it says format on save this is commented out if we uncomment this this is what actually makes it format every time I save so the other one is what it's doing is it's make sure it's loading loaded so let's go ahead and uncomment that that'll be loaded and I I'll just show it to you real quick I'm going to save it and quit Okay I'm going go in let's go back right back into where we were okay so now if I put some tabs here and then I save it I save it with W nothing happened okay it said down there that I need to reload but but nothing happened here so what this is doing is making sure that the conform module is loaded and it's ready to go it the actual action of formatting your file is not that's not what it's doing this is saying load this module on the event of the bruffer prewrite which is fine so I'm going to do the format it right there okay so if we go into the other file and this is the configuration for conform Right Here style Lua so sty ala is being set up but right here if I select all of this and I use space forward I'm going to untab this and this is going to they've already kind of set this up for us and they said hey this is going to do the format on top so the other one was just making sure it's loaded this one's actually doing the action so now if you can see how that there's two spacing here and all this formatting so you can see that this file is set up with two spaces not four spaces um so what I'm going to do is I'm going to save this okay I'm since I've just uncommented this it's not actually you know I need I would need to unload it and reload it so I'm just going to quit it and re reopen it that's the easiest thing for me to do instead of worrying about what things have been reloaded so now this file right here it if I save it right now with this thing has now been turned on the uh format on Save has now been turned on this should switch from two spaces to four so let's do that so here's a w coming there we go so now we got format on Save that's really nice now we have at least the style Lua set up I mean they've already set it up for us but we've just kind of unpacked it maybe understood it a little bit better but these other ones are commented out I'm just going to leave them here for now because they're not doing anything wrong to me this is examples of if you're doing CSS and HTML you could use prettier um but styu is not automatically being downloaded and we're going to take of that later right now this is just good enough right now it's being loaded and every time I save it's going to switch it to this the formatting style that I want and it it takes care of other stuff too I believe if I put Extra Spaces maybe here yeah it's G it's going to fix all kinds of stuff when I whenever I say okay so that's not too bad that's pretty simple stuff that was our first one in plugins in it and we just basically needed to uncomment that so now in tree that I'm going to I'm going to depart from what they're doing a little bit and it's it's a little bit strange because they've given an example but their example is not it's not right so I'm going to kind of show you where where this is coming from and what what I'm doing with this so there's there's one thing is I don't want to configure I don't want to configure tree sitter in the plugins folder so I'm going to break it out into its own file called um we'll just call it treesitter I've put here invm treesitter because that's the actual name of the module but I'm just going to call it tree sitter so I'm going to have to edit this but we're going to break this out but there's more stuff going on here let me let me just show you what I'm talking about so in here they give it us they have us an example here for tree sitter okay now this has Vim Lua Vim do HTML and CSS so if I look if I want to look at what is already installed for tree sitter I can do um the colon the shift colon I can do Capital TS and then capital I install and I can say capital I info okay and this will tell me what's been installed and you see I have C bash what else is installed here we got Lua Lua do markdown markdown in line um print f F which is not C print F but it's actually for um printing the output of tree sitter uh we got python we got query there's the Vim stuff so if I were to uncomment this you would think that you would think that it would just be adding to whatever they've installed so if I just uncomment this here you think that's great I'm just they're giving me an example but this is not what's going to happen uh what's going to happen if we look into here if I go down here this is exactly what we were seeing that's from the starter but if I go into the the Envy Chad one oh they did break okay they broke it out so so this is what the configuration kind of look like the problem is is if we use their thing we actually lose what was in here we lose um I think F let see yeah this one is vim Lua Vim doc HT HTML CSS right if I switch to that one it's not the same it's not a one for one I'm not adding to it it's overwriting it and what's more concerning is it's it's not using these either I believe and you kind of see this sometimes so it's a bit of like you're not really sure what's happening under the hood it's when I was comparing the difference between me just uncommenting their suggestion and and having it commented and I would reinstall the whole thing you know I would clear everything out and tell it to reinstall treesitter would not install the same packages it was saying the default one is not being run at all anymore and you need to instead make sure so now I don't know if these two need to be there or not but I do know this one for sure gets trampled on this is getting trampled so whatever is in here if you want to keep it which if that's the default they should just be adding to the default it's not what happens when you uncomment this when you uncomment this you lose some of their default and I'm not sure if the other two is being used at all so what I'm doing is I'm actually breaking it out like they did here I'm breaking breaking it out into my own config file and I'm just duplicating this so I'm just grabbing this directly this this part here that includes all the options because I'm changing the options so I want to I want to break you know I want to break this out and recreate all the options to make sure I'm not missing anything and so that's how I've done it so I I know that's a bit like complicated what I said but basically they're their um their example is not a one for one their example doesn't recreate create what is already being installed so if I were to just uncomment this and use this I would not get the same experience that I would get if I didn't have it uncommented okay but um I also don't want it being configured in plugins in it. Lua I want it to be configured in config U configs the way that they're doing it so I've broken it out so basically in here I'm not using this right here this this tree sitter I'm not using this what I'm doing is is I'm telling this to load instead another file a config file so let's go over to mine so this is how I'm doing it right here this will be in plugins. uh plugins init.lua okay so th this is what I wanted to load and I want to make sure that it is loaded on a pread or a new file which I've kind of gone this Direction on most of the plugins besides the ones that are loading package um besides the ones that need to download packages put them on very lazy so this one it'll make sure that it's loaded anytime we're going to read a file a new file that we' we've opened it up or we're creating a new file and this is all I'm doing to break it out is just right here I'm just saying config equals this function which is just requiring um and again I'm I've changed the name of this it's just going to be configs tree sitter not invm tree sitter so I'm just going to copy this and we can kind of see what this would look like side by side so here is the their their um example one and here's what I'm going to use so it's the the top Line's the same but this options gets uh implicitly passed to the configuration so instead of that config also gets implicitly called as a function and this is just populating the options and then telling it we'll see it in the in the um the next file that we have to make it's telling it to configure it with those options that I'm using so this is just this is just allowing me to break it out I'm going to get rid of this oops um since I want to undo what that just happened there I'm just going to press U I'm just going to select these and delete it by pressing uh D or DD this one right here I want to move it so I'm going to just DD on it again um it deletes it but it also puts it in the buffer so I'm going to put it up here at the top and it doesn't matter if it if you leave it on the bottom or at the top I just prefer it because I know it's going to be running first so let me just see it up there so that allows it to break out into this other file which I actually want to just call tree sitter and it's going to be the way you read this it's going to be in the config folder and the file is going to be called treesitter do Lua the Lua is implicit you don't need to um say it so that means we need to make a file over here so I'm going to save this file here I'm going to use my control h to jump over here on the side and in the anywhere in here inside of configs I'm going to press a to make a new file and I'm going to call it treesitter and Lua so treesitter Lua hit enter on that and now that file is created we can open that just by hitting enter and what I'm going to put in here is just basically what was there the this this this entire part right here this is just what was inside what I said I would copy out from from uh where is it yeah this this is it right here this is the same thing except some of the names in here I've added I haven't removed any but I've added to them but this this code right here is a one for one to this code the only thing I've done is um made this go downward make sure you have a comma after each one even the very last one you can put a comma just to make it easy so you don't mess up in the future and I've just done them down instead of sideways I've kept all the defaults that were there but I've added some of my own and I've added bash so that I can see bash files I've added fish because I also use fish these were this Lua Lu dox markdown I'm not sure if markdown was already there but markdown you might be seeing markdown files on a Linux system so that's there print F was already there Tomo files we take a look at Tomo files uh Vim Vim docs was already there and sometimes you see yaml files so I just kind of put those those are kind of text files they might come across just in everyday use in Linux just config files that you will come across so that's all I've done I've just basically these items I've put them right here and I've just put them in a local table called options and then at the bottom I'm requiring I'm loading it I'm loading that that's how we load in Vim Trea configs we'd run the setup with the options local table that I've just put in so I'm just going to copy this whole thing I'm just telling you I'm doing exactly what they're doing it's just at the bot they they have another bit of code that's hidden that's running this require I'm just calling it explicitly so I'm going to put that in here and this is where you would would add any new new kind of languages uh for for tree sitter now treesitter is just syntax highlighting so this is going to give us our a Tre Setter can do other stuff but we're using it for Sy syntax highlighting so highlighting is set to True language to True indenting okay so I kind of want to show bash and fish off with this because you might run into some issues so I'm going to save this now when I close close this and restart um Envy Chad or neovim it's going to grab these missing languages bash fish markdown uh toml and yaml it's going to grab these automatically and that's just how um tree sit works by default so that's nothing that I'm doing it's just going to automatically you saw it when I first set it up that it grabbed whatever what the the initial default ones that were there it's just going to grab these two so let's check that out I'm going to put it and when I launch it again it's just going to grab the new ones I think it should maybe I did something wrong hold on I think it gets run implicitly when you very first install I'm G to put this on lazy oh see when I've loaded yeah I'm going to put this on lazy because of this um it doesn't really matter this is not going to affect anything it's fine but they're installed now it installed the five new ones um what what happened was I was expecting it to automatically install when I started up in invm but instead it actually installed when I opened a file when I opened this file here because it's on Buff read pre so opening a file or creating a new file and on the other ones this would be a real problem because I actually want everything installed first the first time I boot it up I one installed but I do know that treesitter does get run when you very first install it no matter what you don't have to open a buffer or anything it does run automatically Al so I might just leave that the way it is um because if I I could put it to um lazy here or to very lazy as the event I'm going to leave it it's going to work good enough for me because you're going to see that this is going to run no matter what without me even opening a buffer when it's very first installed the other ones will not so we will'll set those to very lazy but so that's going to give us tree sitter I do kind of want to show you fish and Bash and some issues you might run into I'm going to change into a completely different thing for uh dtdt helper I just need some fish fish uh files okay so this this this dtos helper. sh this is a fish file okay so if I open this it looks pretty good it looks like I get syntax highlighting but when I scroll down a bit things start falling apart it's it's not right it's all red now it's white the color the colors aren't right see up here if is purple and end is um blue right down here if is purple end is red now if is red this thing is Fallen apart okay it's it's not working correctly let me show you what it should look like um this one is is named as fish so instead of sh it's fish so when I open this one up it looks similar again in the beginning but when I scroll down my if and end are all working now see if and and if there it's all it hasn't broken down so what it what it's doing is it's kind it was trying to read a fish file um as a bash file and for the most part it is very similar but they're not the same so it it starts falling apart and we can see this if I were to find out what file type this is right here I could say I could go to colon I could say Echo and I could do file type with the Amper hand in front and it's a fish file right this is the one that works by the way um I could also do set and I could say file type but not equals I could just put a question mark and it will also tell me what the file type is which is file type fish if I go over here to this one and I give the same command set file type with a question mark it says it's file type is an sh I believe sh just defaults to bash if I try the other one Echo file type okay it says SH now down here where I yeah I put I put some helpful commands here so you can do TS install all you can install a single language if I wanted to say in install fish if I wanted to do say fish wasn't installed I could say TS install fish it's already installed do you want to reinstall it you could also do that to update TS update and I could say fish or I could say TS update and don't put any language there and it should just update everything everything's up to date good um I disable highlighting and enable highlighting so TS disable white it disabled it for this one not for the other one okay I I I don't know why TS enable maybe it's the last buffer I open I don't know and TS enable highlight turns it back on I I don't know why it was different these commands I'm just kind of showing you but the one that I really want to show you is this one right here this Lua print um require now so if we if I put this in here I put colon then when I paste it in since I've copied the colon I need to go back and delete one of the colons and this colon I believe needs these are don't they don't have to be there but I believe it goes like this yeah so it's telling me that fish is being used on this one but what about this other one right here that identified as sh the set file type with the so this one identifies as sh not fish so if I give that same command again and I yeah I got go back to the beginning this is identifying as bash so tree sitter has loaded The Bash now I kind of know what's happening and you probably already guessed but you could have a a different a different language going on other than bash and fish you know where you're just really frustrated why is it not quite right or you're not sure if it's loaded the correct one so this command um will tell you and I've put it in the page here it'll tell you what is being loaded for this buffer what tree Setter has loaded so I was struggling with this earlier so this one's loaded as bash right well I can tell this one to be a different file type so I can say set file type equals fish right now if we go down it's fixed now now let let me set it to the other one so you can see it set file type equals Dash see see how it's kind of messed up now it's not the Echoes are not colorcoded right than it's got different colors going on but they're not correct so if I set it to fish and all the colors look correct yeah they're correct now so some of the the the stuff is wrapping around but anyway if I were to give that command again that I've changed the file type to fish it says it's fish now so it just me changing the file type loaded told treesitter to load the other language instead okay so if you ever come into this problem that might help you out so I've put all that kind of stuff here you can also use inspect see and and what inspect does it gives you some information but if you notice here on the side it says fish says fish so that way I know fish is being used if I change the file type and now I inspect something this I'm hovered over choice so I inspect it says bash here instead of fish so you could use that long command I used or you can just use the inspect one and see if it says what whatever language it's saying here on the side is probably the one that's loaded okay so that's just kind of something that was throwing me and basically the um if you see I was naming my shell scripts as sh but they're they're she banged as fish up here because this is specifically a fish script tree sitter doesn't understand that treesitter sees. sh and just says that's bash because most most shell scripts are going to be bash but if I explicitly give it the fish then it says okay now I understand it's fish so you may have shell scripts that are written in one or the other or other languages happening and it might not be apparent which thing should load you might need to forcibly tell it so yeah you can just do that you can just set the file type and it should be able to handle it if it has a language for that okay so I think that's everything on um tree sitter that I have for you okay so we have this kind of language server going on we're using the um Lua language server which is lore LS and I kind of want to set it up as well let's see what it's looking like by default I'm going to come out of here I'm not really changing anything here I think the only thing I'm doing is setting when when it gets loaded on the the read and the new file is what I'm doing here yeah I just put a above read pre and new file that's all I'm doing so I'm just going to copy this and I'm going to put it below treeit sitter and above conform doesn't matter that much it doesn't matter what which one's first which one's second just for me I'm just going to put it like this so not really doing anything I'm just putting the event um but I I will be doing something else where I need this here later so so it's basically just this one down here I'm not I'm not doing anything that is different about it it's getting the defaults from the built-in Envy Chad and then it's loading the config so I'm just going to remove this old one down here now and also I'm never going to use this one right here so I'm just going to remove it okay so nothing's happening here let's just save this but I am going to change how Lua Lua language server is run so if we look in here the ls P config what it's doing is it's it's kind of setting stuff up for us to be able to do for for for us to be able to do different things right so right here there is they're making a local table that has HTML and CSS language server in it this Loop right here is just going to run through this table it's it's doing a um for Loop and it's just grabbing the index we're ignoring the index with an underscore and we're calling whatever the values are calling them LSP so this for Loop has a LSP that basically becomes HTML and then the second time through becomes CSS SL SL and it's called pairs that that just means that this first one this is not a um this table here is just kind of like a list it's not a key value pair we only care about the value in it it's going through a list and it's just basically doing each of these things it's it's creating this local onattach local on in it the local capabilities and it's just setting these up for each one of these now we don't care about these so I'm not actually going to use these but this is just basically if you just had um any kind of language server that you did need to do anything special to you could just put the name in here and it would automatically go now you don't see um Lua LS here because it's actually done internally right here okay so it's actually being set up here and you can kind of see these unattached capabilities these things are being passed in and the settings here is is kind of done under the hood but I want to change a couple things so if we change a couple things we need to again recreate this whole this whole table basically they have an example I think oh no they don't have an example so this one right here for typescript is just the same thing as up here but not in a for Loop and specifically for typescript so this for Loop is doing this exact same thing but with HTML and CSS LS so this is just an example I'm not going to use typescripts if you are using typescript you can just leave it there but that's just it's just an example I'm going to remove it um this one I am going to use but I'm not using these I'll show you kind of what I'm going to do here so I've I've kind of talked about we need to edit this file the ls uh LSP config.lua and it says we'll be adding a table list of all the servers to configure so I'm going to have two list here I'm going to have a list of servers that um like a complete list of all servers that are being configured because What's Happening Here let me let me show you if I undo here if I'm running this I actually have four servers that are being configured here I have Lua is being configured under the hood hidden from us and then HTML and CSS LS is being configured with this for Loop here but then typescript is being configured right here so that that's four different ones but this list uh this table only has two items in it so I actually want a table that has all the items in not just the stuff that's being configured by the default so I'm going to make a second list I'm going to have one list that is just hey anything that needs to do the default thing do the default thing but I'm going to have another list that's going to contain every thing and I'm going to save it inside of LSP config so that I can access it later on so I know all the stuff this is because I want to be able to automatically use Mason to download these later so I need to know how many things are being uh how many things are being configured I need a list of all of them what I'm going to do is I'm going to create two list one list is just everything being configured the second list is going to be whatever is using this for Loop this for Loop will be anything using default configuration the other table will be all configured servers everything so that I'm kind of explaining that here I want that table of all of them for that I could use Mason LSP configs to automate the installation and I used their defaults again I went instead of the starter I went into the internals because I I I want to edit this I want to edit the the Lua LS and I don't want to break it I want it to keep working correctly but I want to make some changes to it so because of that I'm actually going to take the same thing out cuz what happens here right here this require LS setup when I make my own version it's going to ignore this and so whatever was happening here by default is no longer going to happen so I need to recreate this so you're going to see these lines here you're going to see all the stuff in settings I'm recreating it because if you don't recreate it then um you're going to L lose those capabilities what I'm doing here is I'm taking the file that's already here and then I'm adding in the leis stuff so that's what's going on up here all the all of this is what's already in the file now this list right here this is my list of all servers that are going to be configured every single server so for my setup right now it's just going to be Lu LS nothing else I don't need types script server I don't need HTML none of that stuff so my entire list of servers that are being configured is right here my list of servers that are being configured with default configurations is just empty but the list uh the the table is here so you can add stuff to it if you want to activate this block but anything you add in here you should also add it up here because this is needs to be a complete list of everything and then and that's what was already there we've already seen this before now down here this is just a recreation of what was under the hood for Lua LS and the reason why is because I want to add um love support so I need need to add this third party love but also on top of that on top of adding that that actually doesn't make it completely work it still doesn't work when we do this and it's because it still can't the linter still can't handle love and some other things so I'm actually going to disable the linter on this and use the other linter but this is still set up so the the language server still knows about love 2D and it's still can give me auto completion go to definition things like that it still works as a language server but the linting will still complain even if this is here just partially and it's quite annoying I searched for two days on this how to fix it and there's just no fix I ended up running into a bug report that I had put in like a year ago into um the guy who writes the LSP config the the sorry the LD language server and that guy was so arrogant that they just never fixed it there's no fix for it so that is still a problem and you can't communicate with them so so I'm going to do this I'm just going to overwrite the whole the whole file right here because this is already going to be here this is still going to be here this is slightly modified I changed the name of the servers I just changed the name that's the only difference here I've removed this and I've added in the the Lua config and then I've added in one other table up here that is all of them so I'll just I'll paste it in and then you'll see them together I'm just going to put it below okay so this is duplicate right here these top two lines so I'm just going to remove them okay now you'll see this you'll see this instead of it saying local servers it says LSP config dovers so I'm actually sticking a t inside of LSP config that I will be able to access later on whenever this is loaded any other package will be able to access this list that I'm creating this is a list of all servers configured okay so this is a a new list now we're not using um typescript servers so I'm going to get rid of that okay so we have this um this automatic thing right here where we have a table anything in the table gets automatically configured so so that I've just changed the name from servers to default servers that just means I have this de default configuration right here when when they just need to do the onattach on init and capabilities they just need to plug these things into the server and nothing else is happening we can just put it here so it's really just the same I've just changed the name of it and I have nothing in the table by default right now later on you will put other things not not in this video okay so these are here these are here this is my table I'm creating this is the one that's using the default for Loop now this is my my version of Lua LS we shouldn't need to actually because I have this here I can actually just Say LSP config do this that should be fine because this right here is making a local variable oh th this shouldn't be here I I'm not sure what's happening with this I think something got pasted when I wasn't paying attention um yeah that's that just shouldn't be there I was just kind of wondering where they but th this doesn't need to be here because we're already we already have this local we're already requiring it right here and so we have this LSP config as a local variable and so now we can just LSP config and do the set up let me just save this file real quick because I think it it's going to add in those yeah it's added in those parentheses right here this was because of the changes that we made in in style Lua right here where called parenthesis es was none that was there initially um but I've removed that cuz I like that if you don't like the parentheses you can uncomment this and then it'll go back to the other way but I do like to see them that's just my my personal reference so what I have going on here is I I've have this disabled and they also have this other thing which is a bit confusing to me um they have the a global set for Vim but they don't need it so I'm going to enable this um by by commenting it out so it should be enabled now let's just go in and double check it in the original version yeah so the original version they they're using this Vim here um as a global so it doesn't complain about Vim but you don't need to because it it's it's already set up to work with it so I'm just going to set it to there and just show you what it looks like okay everything okay I'm going to show you what what a love file looks like now we've added love down here I just want to comment this out I'm going to comment it out first and I'll show it to you but you you see um that the VM these these four Vim lines here it's not being complained about right I'm going to comment this out and it still will not complain about okay let it load and yeah there's no complaints about Vim so we never needed Vim to be in a global okay but I I don't have anything here for love 2D so let's load a love 2D file he we should get a bunch of complaints there we go bunch of complaints because it doesn't know what love is okay and and there's 26 complaints here okay now if I do kind of let it know what love is these complaints will sort of go away let's see if we have autoc completion as well okay we got autoc completion we got draw we got load it might be kind of guessing what it's already seen in this file though actually here but anyway let's let's go and try to fix it so I'm I'm messing with the LSP config right now this the language server and specifically Lua now this isn't actually doing anything this table right here is literally just making a table I'm going to use it in the future it's doing nothing on this page right here the only thing that's configuring Lua is right here this one so we know we don't need um themm and we know that Diagnostics is working right now because we don't have any other diagnostic so it's definitely coming from Lua LS now if I if I put this here well let's do the other one let's use the global if I put the global here I put love in here I think I think I need a comma do that maybe even a comma here for good measure don't need it but so I'm going to jump back into that other file i' I've saved it and closed it at the same time so now we we'll probably have four errors okay it's going to be duplicate something it's going to be down here here we go we got we got four I just want to try the little love command again love dot we got the same stuff going on okay okay so we got four we got four errors um the problem is is I've told it to ignore love and it's not ignoring love it still has these four errors and I haven't seen anybody else that can kind of solve this um even even people who are showing off love and in Lua and showing videos of it still have this problem and it's only a minor annoyance but it is kind of annoyance it feels like you're not doing it right um so let's let's take this the other direction let's do the the there's a third party Lua extension for luor LS sorry so let's use that instead of the global thing so I'm going to just comment this out again and down here this is one that was that we're we're adding now so this is a third party thing I found this somewhere online um it is part of luor Ls they is a love third party module thing going on and this seems to to be the the right way to activate it but I will get a similar thing as as when I put it in globals up here I'm going to get a very similar I'm going to get the same for um issues okay it's loading up and we still got the four yeah but look at this when I type love now I got a whole bunch of stuff going on so our language server is understanding love now it's cool with it but we still have have four annoying right so that is better it is better we got the functionality of the language server but we still have this duplicate field um issue going on so that's kind of where I'm at with with this that's kind of why I've pulled this out I've added the the line under here I've added to it I've I've commented this this out because it does nothing the the Vim doesn't need to be a global it's already understands Vim so you put something in the global when you're telling it to ignore it we don't need it to ignore um them so I've commented that out and I've added in the other but actually I'm going to tell it not to use the linting part at all because I'm going to add um in uh Lua check instead as a linter but I do still have the third party let's close this out the the love 2D I I need to save the buffer so I just kind of wanted to explain what I was doing where I was getting it from I am pulling it from the from what's under the hood to preserve how it should be acting um you know I want to preserve all the stuff that's acting this is where later on you could put other stuff that you wanted to ignore however I don't have anything that needs to be here now um but right here I'm going to tell it to ignore lenting because I'm going to use a different linter but I'm still going to get the benefits that we just saw of me being able to autocomplete and things like that for the language server having love 2D support so I do want the support but I'm going to part of it I wanted to just show how lters were installed so I wanted a linter for l anyway and part of it was is the other linter doesn't give me the same problem um so we're going to use that one so this is how I'm going to set this up okay in the old version of um Envy Chad they were using null LS and that has been um n LS is deprecated now so I've switched it from from um from n LS to LSP config conform and lint okay so so that's the whole spiel about LSP config and that's why I did that so we've finished up everything now let's go on to the linting that's the bit that wasn't so I'm going to do the exact same thing with the lters everything else and I do have these Pages opened up I haven't been showing them but basically here's invm treesitter and you can read through tree sitter and I have a this is linked in my page to all of these pages and these are the languages that are available okay and here is enm LSP config and we've already done this but this is the page for it and again it is linked and it there's lots of information here there is enm lint which is what we're doing now this is going to be the linter and I I did have some good time trying to understand the magic that was happening under the hood with this one as well and there is different names sometimes the names don't line up to the tool um so there's the information here so so this is the one we're working on now the invm lint so I'm going to this is going to look very much like the other ones this is the the the where I'm getting this from here is from GitHub okay so if we look at GitHub and we look at this name right here and the repository that's what it is that's what it is for all of these okay so that's the GitHub that the event when I want it to load is whenever a page is being opened or a page is being or a buffer is being opened or a buffer is being um created you know a read pre a read pre or a new file and I'm just doing the same thing the config I'm telling I'm breaking it out into another file that's in the configs directory so this looks very much like the others I'm just going to copy it and and all of these are always going to be in the Lua and the plugins in it that's where all these are so we have tree sitter we have LSP config and I'm I'm going to put it between conform and LSP config so it you see all of these this is the GitHub page so it's github.com and then neovim in Vim LSP config that's the name of the repository yeah and it's the same I'm telling them to accept on the conform one the conform one does it on right it's telling to load at least before I before I save a file the other ones are are when I read a file or I make a new file and so nothing is happening new there is there is no I don't need to uh to bring in a default or anything like that that is doing an LSP config it's just going to be like the other one so this is just saying I need the configs it's going to be in configs we're going to make a new file called lint so over here lint do Lua so we are let's create file we've created that file so this is the key value pairs of all the this style is um let me see here it's very much like the confirm one so these are key value pair so this exact same setup right here that we're seeing on the top here is what we're going to do on the other one so it's lters by um ft that's um what we're creating this is from the right here is it lint yeah so so this required this is where I'm getting this information from their key value Pairs and yeah so we need to require that lint is loaded so we're creating a local a local value lint and then we're using that lint lters by feature and what we want is Lua check for Lua and we're going to configure this one and and I kind of want to show you how I came about this but down here we're creating an an auto command basically we want we want this um this action to try to lint which is to check to to tell the linter to check we want this action to happen whenever we enter a buffer whenever we write something or whenever we um switch out of insert mode when we're in insert mode and we go back to another mode other than insert we wanted to check linting so this is called an auto command so we're creating this Auto command and we're telling it when we want this Auto command to kick off and this autoc command is just going to run one thing it's going to say lint try lint so this is the linter that we want to use this is a specific table and I'm going to show it to you in a second here I I had a hard time with this one so I just want to make this file the rest of it kind of follows the how everything else is you know with the with the um we're requiring lint we're saving it as a local variable and then we're so we can use that without having to say over and over again require so this one down here I'm going to save this file I haven't saved it over here I'm just going to post this so I'm going to comment this out and I'm going to save it so what H what's going to happen here is if this is being used now as the linter it's going to start complaining on anything that's love and anything that's Vim um for linting okay because I've I've commented this out this is kind of adding um arguments to it and we're going to look at this in a second here so I just want it to work so this is just making it work this is telling it on the autoc command when this is going to actually trigger each time so I I'm going to reload it now when we see anything that has Vim in it or love in it you were going to see complaints coming from the linter I know this has Vim in it I don't think this is all set up correctly to be honest wait wait wait is lint installed oh okay it it's not installed right now so I'm doing a Mason install and um BL check okay now it's installed we're going to fix this later but anyway now you see that it's complaining about um them right because the linting isn't happen with Lua language server anymore now it's happening with lu check so if I do control W and then d i can get the hover version of what the and it says accessing undefined variable it doesn't know what Vim is so the linter is complaining about Vim now the LSP the language server knows what Vim is but the language server is not doing the lenting anymore so I could still get autocompletes and everything else from Vim because it knows what Vim is but the linter is L check and it doesn't know what Vim is so this is where I came into a problem that took me like two days to figure out and it's this so this was the best answer I came across um and it's this is like um how to make it not complain about them or about love anything else right and I came across a a a couple things but basically no matter what I did it did not work and there's some other post I didn't I don't remember all the posts now where I spent two days just everything that I could find on this digging into the internet and asking the AI models it was getting nowhere and it was really really frustrating so let let's just try to add these in if I copy these and I and I un comment it well yeah going to uncomment part of this say that part that part and I just put this in I I want to preserve what I had going on here okay so we got globals and we're basically saying hey these globals Vim lvm reload this ignore these um I actually don't know what this bottom one is right here but I I kept seeing something like this like five or six different post and then just nothing else at all was always something like this and it needs to be in the arguments so this is um the lter so if we go here there is a how to pass arguments so it has it right here so this is the similar thing to one I'm doing it's basically saying you need require lint and then linters and then the name of the language that you're doing with phpcs here and um it's just they're just creating a local thing that's phpcs and then using it here you could just do this whole thing here with args at the end it doesn't really matter how you're they're they're just making this equal the this local variable right here and then they're using that local variable and accessing the the args table and putting stuff inside the table right so I hope everybody understands how kind of Lu kind of works on this but anyway doesn't matter it's the args table that we're accessing and and and this is what you would put in for PHP now we're not using PHP we're using something else um so this is where I came across what I should be using for Lu Che you know these ones and and I did come across this like six different people posting the same thing and this just does not work this is not right at all so if we put this in I'm going to I'm going to save it now see I'm getting this Vim complaint so if I fixed it I shouldn't get this Vim complaint right so let's let's write it and quit it we'll go back into um lint and nothing's there look wow I fixed it right looks amazing I I'll go into insert Mode come back it looks like I fixed it let's look into a love file cuz we know the love file should have like 26 um errors at least the linting for love hasn't been set up to ignore it there's no there's no love in here for the globals and the Lua LS is not checking linting so that's happening only here not the other one so let's go check a file okay I got nothing there's no errors at all what's really happening is is Lu is not working at all it's not doing anything and I was fighting with this for a very long time until I was finally able to to instead see what should be in that table I need to know what NE what was already in that table in the past so when I modify it it's still working so I've put this here um so this Command right here we can do the Vim inspect this is just Lua print we're doing a Vim inspect and we're doing the requir lint linters l a check and there's the ARG so this is the table that I've been trying to to change but before we change it I thought maybe I should see what's inside this table to begin with and then modify that okay so let's try that let let me I'm I'm not going to get it with the colon I'm going to ignore the colon because that's already going to be there when I do the command but I'm what I'm going to do here is I'm going to go back into the um I'm going to go back into here and I'm going to disable this whole thing because I want to see it when it's working but I can tell you right now it's not working it's not doing anything there's no lenting happening so I'm going to close this and I'm going to get back in to where it is linting okay now we have linting happening because this Vim right here is um complaining so we're good linting is working so I'm going to paste in that command that um inspects this this table so right right up here I'm doing that local lint require lint and then I'm taking that guy and I'm it's right here lers blue a check and then args this is the table right here that I'm trying to modify right now it's using whatever the default version of that table is so let's find out what's that default version okay now here's the default version formatters plane code so this is setting formatters to plane setting codes setting ranges and then setting a single Tac now that doesn't look anything like this so I don't so I I can assume that these guys are all related to to globals I'm not actually sure what this is but I'm assuming that these must be in here so I put those in there I put formats plane codes ranges and that okay so if I put all those in there if I were just I'm just going to delete this oops just want to delete it okay so I'm going to turn this back on but this time I'm going to put in these that were there by default these were already in there by default when I looked at it so if I do this basically I'm recreating the default version and I wanted to see that it yes it it works right I'm going to save it quit it and I'm going to come back [Music] in go back into lent and yes I do have it complaining about Vim awesome so I know with this file it is working now so let's let's go and let's tell it to stop complaining about them okay and I'm going to leave love alone because I want to see this go away but then go into the love file and see that it is still working because I don't want to break I don't want to break it okay so Vim is no longer complaining here so let's go back and look at love love should still be complaining what did I do okay yes got 22 complaints on the love file okay so let's go back into in the love one oh I should have showed you as well I I didn't do it but I I should have showed you before that the linting was broken by I could have changed like lint to like a different word and it it wouldn't have it would said anything like linting was completely turned off it was not working at all but anyway I'm going to put this here now love is here okay so that's saved and now we go into here and hopefully we get no complaints at all and I got no complaints okay but is is the LSP still working for love love dot it looks great okay so I I wanted to show how linting works because other languages use linting even though um Lua language server has its own lenting put in I figured I didn't want to add other languages I just wanted to do the Lua because that's what Envy config Works in this video so that's how you can use linting you can switch it back to the other one or you can even turn them both on just by uncommenting that one file I'll show it to you so if I wanted to turn on the other one I would just go into LSP config and WR down here where it says enable equals false this is Diagnostics this is the linting if I put this to true or just commented out then this one will also be active and I believe they can just be active together you'll just get one or the other complaints or both both complain I don't think it's really a big deal here um but this at least gives us um 2D support right here and I do have this turned off because the other liner is on and it seems like it's a little bit better experience but you can go either way okay so that is the that is linting and that's why it's like this basically I didn't know how to do this and I couldn't find the answer anywhere so as far as I know nobody else has this working um I'm sure there are some smart people that do have it working but they haven't shared that information with anybody else um but basically it's kind of like trying to peer under the hood what was the default set that I'm changing do I need to recreate that whole default what was already in the table before can I inspect that table and find out what was in there so that I can modify it because I could find in L che I could find what I needed to do and I could find for love and Vim what I needed to do with globals but I didn't know what was in this args table before that was working so now that I could see what was working I could just modify it um okay so the the the problem now with this whole setup is is if I if I remove my um the the state and the share folders where all this stuff has been downloaded to and I just have the config and I restart it up um these things don't automatically get installed now I did have this set up at one point just to automatically install everything but the problem with that is is sometimes your LSP through your package manager is the one that you want to use the one through Mason is broken or doesn't work correctly like say with Haskell um I think there's also an issue with um with clang clang doesn't work right I believe through Mason it's better through the package manager I can't remember which one but so sometimes you want something configured here but you don't want it to be actually downloaded through Mason so you you want something to be configured to be used used but but it's actually from your system so that is what we're going to do next we're going to make it where we can automatically download and install all these packages but we can also ignore some packages it still have them configured but not have them downloaded so we're going to be using some other kind of helper packages and basically there it's m you know we have conform we have LSP config and we have lint so there's going to be Mason conform Mason LSP config and Mason lint and those are just going to be there to help install them so the easiest one is the conform one the conform one is very simple we've already seen this kind of AD we know that this is coming from uh coming from GitHub right here Mason conform very simple simple thing going on and it's very and the configuration is extremely simple this is amazing because it just works and I like things that just work so this is very simple it just works it installs everything automatically except anything you don't want it to install you just put it in this ignored list so if you didn't want it to automatically install prettier but you did want it to configure prettier there you go this is what it does so anything that's not in this list it automatically installs if you're configuring it anything in the in the list it's not going to install it but it will still configure it so if it's installed on your system it's good so we're basically just going to do this exactly the way it is so I'm going to go here and this is just basically what they have except I've set this to very lazy and the reason why is I want this to run I don't care if it's in a buffer or not I want it to run every time I start up neovim but it doesn't need to run right away it can be very lazy it can run very late because basically this is just checking do I need to install a package I don't want it to run when let's say um this is conform so it's a style Lua I don't want it to try to download style Lua when I've entered a buffer where I need style Lua what I want it to do is install sty Lua when it's done starting up and then it says oh you know what stala is not installed let's install it so then when I go to enter something that needs sty Lua it's installed so that's why these these are very lazy all these Mason ones I'm going to do are very lazy that means they're they're not run I don't need to do something to make them run they're automatically going to run but they're going to do it late stage they're not important they're not going to slow my down my startup speed down so this is going to go into plugins and now all of these I'm setting these beneath the whatever they're modifying so this is conform um this is Mason conform so I'm going to put it below Mason conform okay there it is very simple thing and there's going to be a config file called Mason conform so let's save this and then go over here we'll make a new file oops okay we'll open that up and it's very simple it's like right off the website what they said here's my ignore list that's it it's all I want it to do okay so if I didn't have um styo installed right now when I started up neoven it would automatically install it so let's see can I oh yeah there it is right now right now it's installing on the bottom so whenever I start up a thing it automatically will install it if it's not there now if I didn't want it to install I would put it in the ignore list so that that's very simple I have the um the the page for it on all of these and the setup it's very straightforward on that one the next ones are not so straightforward because they they're supposed to act the way that this is acting but they don't work in practice I could not get the other two they have an automatic install where it can just automatically install and then there's an ignored list or one of them has I think an ignored list and the other one doesn't but the autoinstall thing just never ever worked like it would work one out of 10 times even even know I had them starting in the right order part of it might be because other stuff is happening under the hood with um EnV Chad maybe it's loading a module before another one I'm I'm not entirely sure but if I tried it 10 times it would do it once or twice correctly and I I just wanted to do the right thing so instead of telling it to um so down here you can have this automatic installation down here you can set this to true and it should work on its own and actually needs to be loaded before LSP config is loaded instead of after it but again I could not get it to do the correct thing where I was confident that it was going to do it I mean it wasn't even 50% of the time so and the other way to do it is actually have a curated list that is that you ensure installs so basically say hey here's the list of things I want installed can you install those so because of that I need a list coming in but then I'm might have certain things that I don't want installed automatically because again they might be on the system so I have this local table where anything I don't want to be automatically installed I can put in here so now I have this list that is being handed to me but I need to check the list and remove whatever is on the ignored list so that's what's going on here there this is a this is saying all the servers that I want installed it's checking that internal servers table that we created earlier that I put the Lua LS in and it's going to go through that for each item in my list of servers that are installed make sure it's not in this list of items that need to be ignored if it's not in the list of items then we're going to add it to this new table that is all servers that gives me that takes the list of all servers that I'm I'm configuring removing the ones I want ignored and then I'm passing that off to to ensure installed and this is going to install all of those and I'm turning off the automatic installation that would just install everything this is just a loop going through all the servers that I'm passing to it that we've created in that when I was saying that I was creating the table inside of LSP config that's that's here right here I'm I'm getting that from right here up here I'm loading this package I'm getting this LSP config and inside of that is that serers list so I'm going through that whole list of thing and for each item in the thing I'm making sure it's not in here now the way I check if it's not in here is this helper function that is another loop because this is also a list checking to make sure that item so this is just a helper function L doesn't have a direct way to check to see if something is in a in a table or not so you have to iterate through the whole table so this one is iterating through a whole table of things and for each item in the table it's saying if it's in this list which it's using this function to iterate through that table to compare the value if it's not in the list it's then adds it to a new table called all servers um and then passes that down so I know it's complicated but this is the only way I could get it to do the thing that I wanted to do every single time and if you have anything on your system that you don't want installed through Mason you want it on your system you add it to this list it still gets configured but Mason is not going to install it okay so I know that's quite complicated I'm just going to put this code in um so this is the [Music] Mason LS LSP config okay so this is just given access to LSP config by loading it this is just a table of whatever I want to not be installed automatically this is my helper function to see if the value is in the table that's all this is it's just a generic helper function this is the loop using that helper function it's looping through my whole table of servers and then checking each server to see if it's not in that in that ignore list by using this helper function and if it's not it's adding it to the all servers and then it's making sure all servers is installed and I'm turning off the the automatic one because that was completely unreliable so this would be filled up with whatever you want on your system so I'm going to write that I'm not going to reload it I'm just going to continue on to the next one it's very much the same story I did put the Mason LS P config in right so I need to add the Mason LSP config here and there's nothing new happening with this one I'm putting it underneath it now if you were trying to do the automatic thing you would actually want it loaded before it but again I could not get it to do that reliably so I'm putting it below it and what's happening here is this is going to use a table that is being created in this one and it's just the table that I'm creating and I'll show you that table see right here this table this is the table I'm creating and I'm sticking it inside a LSP config so this servers table I'm sticking it in there and then when I go to here I I'm pulling it back out I'm pulling that right here that table I'm pulling it out here so I'm I'm Gonna Save this one so here is invm um LSP config and here's Mason LSP config and this one is set to very lazy because this thing needs to load it needs to at least be loaded when you're reading a buffer or making a new file this one I just want it to happen eventually when you start up could be the last thing that happens I don't care but it I want it to always happen I want it to check to make sure it needs to install something okay so I'm going to save that and I did a capital w I do that all the time okay so the the next one is the exact same thing um pretty much but with this one the loop is a little bit more complicated I'll just show it to you I'm going to copy it in this is Mason um lint so this one I'm going to put it under the lint right here and it's the same thing very lazy same idea nothing's all of these um Mason ones I put them on all on very lazy they're all doing the exact same thing and this is very similar to the other one I'll just show it to you this one I didn't need to make the table the table already exists for me um so I'm just using it so a here and Mason and this one's going to be called lint so what's going on with this one is there's already a table that exists when you're in lint here this this this table already exists and it's it's key value pairs which becomes a problem because you need to separate the the key value and also that's not actually the problem the key value pair the problem is is you might have multiple things in here you might have another one here too you know Bob's check or something I don't know Lua might you might have multiple lunter installed for Lua so because of this idea that you might have multiple um we need to take care of that as well so so in here I'm doing the same thing creating a local ignored list I have the same exact helper um function right here that's just checking if the table contains an item nothing's changed it's the exact same function and down here I'm going through the the key value pairs but when I get the value from the key value pair so that I'm calling V that is actually could be a table in itself that could have multiple values inside of it and so I need to check each one of those as a linter if it's not in the ignored list and if it's not then I'm going to add it to the all linter list and then I'm passing the all linter list in exactly like the other one and I'm telling the auto installation to be turned off so exact same thing's going on it's just the fact that each one of these values can be a table in itself that has multiple values inside of it this is all in place now I'm going to restart it and if I get no errors I'm going to wipe it everything except the kig and let it start up from boot and see if it does everything to to the way that it was just set up just closing all these okay so let's see if it it's uh installing those two packages that we just put there and I think that's done look at Mason Mason still got these the the three items that we want there okay so now what I'm going to do is I'm going to REM remove the local state in vim and I'm going to remove the local share in Vim I'm also going to look another file real quick this Lazy Lock Json I'm going to remove that too okay so basically this would be what's in here right now would just be the config as it is so it's the configuration but nothing installed so now when I start up it's going to it's going to start downloading packages it's going to change the theme it's going to install all the tree sitter um languages then it's going to install style Lua it's it's going to install Lua LS and it's going to install Lua check it's going to get all of just going to set everything up for me I'm not going to have to do anything okay if it works see here we go this is the standard it's kind of getting things up and running now we we got 10 different tree sitter things languages being installed we our theme has changed now at the bottom we got style Lua we got Lua LS and Lua check they're all being installed automatically if I just close this and I look at Mason and I got my three I got my LSP is installed I got my linter is installed and I got my formatter installed okay so what if uh I close this one if we just open a file just open anything here so language server is working it's not complaining it's not installed let's see if our linter is working that looks good oops did do that let's see about [Music] formatting that looks good the um we can check on chat RC and we're still in the capucine cuz why would that have changed I mean we haven't changed any of these things so there would all be the same anyway the options that that would already be the same uh let's go into the the love we don't have any complaints cause the problem there we go let's see if we can go to um let's go this love here and let's go GD that works pretty good go to definition it just went to the definition this is not inside the project I'm in I just went go to definition of love and it it went there so that the language server is definitely working the linter is working the form matter is working it's not giving me any unnecessary complaints the tree sitter is working let's see what TS is installed install info and we got C installed bash there's fish Lua Lua do markdown markdown inline um python not sure why python installed but okay query toml and I I know yaml there there's yaml there's Vim Vim do so that's all good and that should be exactly where we were at now what happens is hopefully you understand kind of some of the stuff that I went through to to set this up and kind of how I was able to un overcome some of it although you know it's always it always feels a little bit like a magic box of black box that I can't see inside of and I don't know what's happening but at least now you know that you're looking for highlighting through treesitter your LSP config is your language server that might also be doing other things it might be formatting and linting as well um you have the lenter through and we have conform doing a formatting and how to set those up how to configure it how to kind of look through some of the issues that you might have but uh yeah some of the some of the issues I had to go through and I just wanted it set up for Lua I will make some other videos later for specific languages this was a lot of research into this and um figuring out and kind of trying to document the problems along the way and how I able to overcome some of them and the kind of uh commands that I had to use to kind of find out what what the issues were so hope this kind of documentation helps a bit for anybody else having issues and what each part of this whole system does so yeah yeah hope that was everything that's a very long video sorry about that this is I I've been spending the last couple weeks probably I mean the last week pretty hard um researching this one even more even after I was already using it and I couldn't actually find anybody with videos on on Envy Chad 2.5 again they did Breaking changes and then there was the null LS deprecation change as well and so the information is a bit hard to come by and kind of they assume that you know everything that's happening um the the stuff is written by people who already know how the bits work with each other because they may be writing the actual packages themselves so that's not really helpful to the rest of us when we we don't know what a lot of these things do and how they work together so I hope that helps a little bit for anybody out there that's also trying to figure these same things out and it's a long video so I'm going to end it here and hope you guys have a good day bye
Info
Channel: Programming Rainbow
Views: 837
Rating: undefined out of 5
Keywords: Arch Linux Installation, Arch Linux Setup, SSH Access, Beginner's Guide to Arch Linux, Linux Installation Tutorial, NvChad, NeoVim, lspconfig, nvim-lspconfig, mason-lspconfig, nvim-lint, mason-lint, conform.nvim, mason-conform, treesitter, nvim-treesitter
Id: TNRFegMqbWA
Channel Id: undefined
Length: 111min 49sec (6709 seconds)
Published: Sat Jul 13 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.