Back to blogYouTube Video

Published August 18, 2025

learning neovim from scratch p1

Can't play the video or having issues? Here's the direct link.

AI Summary

The creator documents their first experience transitioning from VS Code to Neovim, opting to set it up from scratch rather than using pre-built configurations (like LazyVim) to better understand the editor's inner workings.

Key Takeaways

  • The setup is performed on Windows using WSL (Debian), which the creator prefers for a superior programming environment while maintaining Windows for specific apps.
  • Configuration in Neovim is handled via Lua files located in the `~/.config/nvim` directory, with `init.lua` acting as the main entry point.
  • The creator established a modular config structure by creating a `lua/conf` directory to house specific settings (e.g., `set.lua` for editor options).
  • Key editor settings implemented include relative line numbers, smart indent, disabled swap files, and a custom leader key (mapped to Tab).
  • The 'lazy.nvim' plugin manager was installed to manage extensions, and 'nvim-treesitter' was configured to provide advanced syntax highlighting across multiple programming languages.

Description

learning neovim from scratch part 1

Transcript

Auto-generated transcript
Hello boys. Just making sure that everything in my stream is running perfectly. Okie dokie. Yeah, everything seems fine. Okay so, yeah, just like the title says, I'm going to go ahead and start learning NeoVim. finally so if you've seen my previous videos any of them really you know that I always use Visual Studio Code I still think it's the best IDE by far I don't think we need to like I don't think we need to argue about that I think Visual Studio Code is the best there is in the market but you know there's always room for improvement and we should always try new things and so on and so forth yada yada yada yada long story short i'm going to try out neo whim now i know this is really difficult to learn and set up so and i also know that there are um pre-built kind of neo whim configurations like lazy whim and kickstart whim and others like that which basically just give you a complete ide without you having to set up all the plugins and everything, right? But the problem there is that they just give it all to you so you can just get started, get up and running and build projects. That is great for productivity. It is not so great for learning NeoWim. And that is what I want to do. I want to learn what NeoWim is, how it works, and how I can turn it from a basic minimalist text editor into a completely full-featured IDE, right? So that's what I want to do. That's what we're going to learn. And in order to do that, we want to set up Neowim from scratch. Now, yeah, my recording is fine. I have, where is it? Where's my terminal? I have WSL installed here. I use Debian. And all I'm going to do is install Neowim over here. And we're going to set everything up over here and just figure out how we can use neo vim how we can set it up how we can install all the different plugins that we need and how we can write the configuration and so on and so forth like i've never done this before so yeah we're going to figure this out so the first thing i'm pretty sure i can just do sudo apt install neo vim and that should work i think but let me confirm it So, where's Debian? Okay, there we go. App install NeoWim, right? Awesome. So, we just do this. And this is going to install NeoWim, and then we can see what comes next. So, I guess I should probably have some sort of an example project to build with this, right? some simple project that I built in NeoWim so I can just figure everything out. Or something like that, probably. I don't know. Yeah, let's wait for it to install. In the meantime, let's see. Setting up NeoWim from scratch. Let's find a good article or something and go through it and then let's see. I had to move to WSL. Yep, me too my friend. That is completely off topic but WSL is an amazing piece of technology right? Like you have the best of both worlds if you use WSL. The only reason I really enjoyed using Linux so much is because it's just a superior programming environment right? It is the best environment for programming. That is the only reason I enjoyed using Linux so much. Obviously, there is the customizing aspect. There is the rising aspect. But I've been through those years before. I've had my rising fun already. Now I just want something that works so I can get work done. I can get shit done. And Linux is just better for that. Now, the problem with just using Linux is there are also a couple Windows-specific apps that I use. Stuff like my video editor and so on and so forth, right? There are some Windows apps that we just need, right? And they're never going to have any Linux alternatives, at least not as good as the original softwares, right? And so we do need both of these operating systems. And WSL just makes things so much better for us. You have the best of Linux for programming and you have the best of Windows for all of your Windows-specific apps. So the way I set this whole thing up is I basically just do all of my programming in WSL. all of the tools that I use like npm and so on and so forth python go and rust and everything else all of my programming tools and technologies are installed in WSL and this is where I do all of my programming and then in my regular windows I just do my other day-to-day tasks my video editing and so on and so forth right um anyway so we have new installed now so I can probably do this and type some stuff. Awesome. There we go. So I do have some basic experience with using Vim motions because I have tried the Vim extension in Visual Studio Code over here. So I do have some experience with using Vim motions. So we're not going to have too much trouble with that. Obviously, the more you practice, the better you get. But yeah. What we need to learn is how to set this whole thing up. So, let's start reading, I guess. Installation, already done this. First steps, okay. From now on, I'll assume we're all in a Unix-based environment. Your config files will go into config.config.slash and vim. Okay, so let's build this first. There we go. See, I do know how to exit from vim. So, where's my config folder? um cd into home slash dot config slash new which doesn't exist yet okay go into config and create a new folder cd into it and let's see what is this after directory i don't know if we need that we need an init.lua file. So all of the configuration for NeoWim is done in these Lua files. Lua is just another programming language and I guess I'll be learning that as well at least in terms of configuring NeoWim, right? So let's see. You have an init.lua file. This is probably the entry point to your configuration and then you have a Lua subdirectory. I don't why we need that and then your custom name again what is this supposed to be but let's see i'll let you research what the after directory does no man tell me what it does i use nconf for your custom name because sometimes i'm a peculiar lack of imagination what is nconf again? It's that what is nconf? In-memory storage engine that stores the nested JSON representation of the configuration. What? Why is this important? What are we doing over here? what does npm have to do with huh this makes no sense i think nconf is just a name for the directory that he used over here not a specific package or something right i hope because this means nothing um and now everything under lua slash and font will be loaded when initializing and neoim okay you You don't have to use nconc. You can use whatever name pleases you. Yeah, see? So nconc over here is just a random word that he used. Not exactly a package or whatever. Somebody's messaging me on WhatsApp. I'm going to ignore them. The stream is more important. The learning is more important. And, okay, so we need all of this stuff. You can have multiple directories at this level if you deem it necessary. Just remember to require them all. Actually do it further down the path. Okay, got it. Got it, okay. So let's do this. In my init.lua file, what I'm going to do is require. We're going to say require. And I guess I'll just call this font or config, whatever. right and then we can save and quit this and then we're gonna have um we're gonna have a lua directory and then can you use mkdir to create subdirectories as well like if i did this lua slash con what would it do yeah see it didn't work so i have to do this and then cd into it And then create the cont. And then it will work. Perfect. So that works. Awesome. Now, what's next? Now we need to create an init.lua inside this configuration directory as well. So let's do that. I'm going to say init.lua. And oops. Okay. module cons not found what the hell okay is that supposed to happen well this is bad um wait a second is it because i just haven't created this file yet or something let's let's try this um map leader and i want to set this to the tab key instead of the spacebar key so uh how do you represent tab in i can't just write tab oh like this okay so angle brackets and and then the tab keyword Awesome So like this Got it Or I guess we also need to add the backslash Maybe. Hmm. Hmm. Okay. Let's just try this. Wait a second. Where did that come from? This will be tab. There we go. that's the map leader that I want to use and then what is all of these I don't think we need to have all of these yet but now I'm just going to save and quit and there we go so this works and yeah awesome so we're not getting that configuration error anymore which means things should be fine now let's keep reading i was told to set my leader key before loading any plugins and i did literally so i told you sometimes i'm not very imaginative and if you know of a better place to set it let me know in the comments okay okay okay in the following lines i have called for three different files lazy knit.lua set.lua and remap.lua okay plugin manager yeah we need to get that and comes with its own lazy folder where i have a file for each plugin we'll do that one last set has all my classic vim settings translated to lua and remap is self-explanatory let's get on with those okay for the last time remember you can name things however it pleases you here's the directory tree so far got it okay all right So we're already getting into some sort of complicated stuff here. Let's create set.lua. And then let's see what comes next after that. We're going to create set.lua. We're going to say... All of this stuff. Holy shit. That's a lot. I could just copy all of this, but I kind of want to type it all on my own. I do this a lot, by the way. Like, instead of copying all the code, all I do is just type it out by hand. And this just helps me to learn and remember it better because I'm just, I don't know, focusing on it more. I don't know. But yeah, I'm going to type it all on my own. this is gonna be a bit boring which is fine because nobody really watches these streams anyway. So, yeah. Stop, tab, stop equals to ship width. You can have width with the ship key. That makes no sense either. Width equals to expand tab. I don't know what that does. smart indent and auto indent yeah we do need those things those are always useful to have smart tab yeah I can use that as well probably tab there we go list I have no idea what list but okay list characters I don't know what please do either but I am just gonna copy this part wait a second I can't exactly paste oh I can awesome I thought I thought the whim clipboard and the operating systems clipboard are completely different but I guess I was wrong line numbers we obviously do need these as you can see right now i have no line numbers so that sucks relative numbers we probably need these as well because they just make whim motions a lot easier to use cursor line probably useful to have as well sign column i don't know what that does but okay yes one okay whatever that does scroll off again no idea what that does but okay show cmd again no idea what that does either swap file i don't think or okay yeah swap files you probably need those so if i remember correctly swap files are just to like for instance the computer shuts down or you lose your data in some way the swap files are one way to recover the code so yeah they're just there to recover the code basically and this guy set it to false i guess i can just set it to false as well we don't really need need them right now backup i don't know what that's gonna do but false um whim.option.undo.dir why do you need a directory for undo that makes no sense but okay os.getend home and before anything else i need to get intellisense and syntax highlighting because this just sucks right now anyway slash dot config slash neo whim slash undo dir okay undo file equals true clipboard equals unnamed why do you need to have this over here hl search no idea what that does but true increment search is that the next one i don't know inc search true ignore case yeah that's that's definitely useful true smart case probably useful okay terminal gui colors probably true because this does look good usually i don't know what what it's going to look like in neo whim but usually it looks pretty good show mode false i don't know what that does either and what is this in the end no automatic comment insertion what does this do? WEM.cmd, auto cmd file type. I don't know. This looks weird. There we go. I'll just copy this. And now we have this, which means I should be able to go back to init.ua and require this file now, right? I should be able to say, if I can type this, there we go. I should be able to say endconf.set now, right? Like, this should work, I think. So, something like this. I should be able to do this now. Let's see. Yeah, there's a problem. Okay. Why is this not working? init.loa and then set.loa in the same place. Okay. Module not found. Why is this not found? Let's ask Jeopardy what's going on here. Because we need to fix this before we move any further, right? Remove this. I'll also probably give it my directory tree so it knows what's going on here. That was not a good idea. Why did I cd out of my file tree? Damn it. While processing. Okay. Okay. Oh, wait. Instead of nconf, it's supposed to be just conf. Lua conf. There we go. nwim init.lua. This is not supposed to be nconf. This is supposed to be just conf. Okay. Perfect. now okay it still doesn't work wow okay attempt to index vip oh i probably misspelled whim over there so set dot lua yeah um where is oh there we go there we go right here so instead of vip it is vim win perfect save and the open perfect now we have line numbers as well as everything else see relative line numbers and so on and so forth perfect so the configuration is working the imports are working i guess everything's working fine now we can move to the next step over here turn off the relative numbers when you're sharing a screen with a colleague most people don't use them and it muddies communication yeah true relative numbers are very weird if you're not a vim user like nobody else uses these i remember when i first tried out vim relative numbers seemed such a like such a weird concept that it i just couldn't wrap my head around head around it right but when i actually started to use vim motions and like just use different um delete insert and other like, WIM motions where you need to use arrow keys and stuff to, like, you know, like, if I want to, if I have some, I don't know, I don't even know if I remember this completely, but if I want to delete three lines up, right, I would do something like D, 4, and the up arrow key, and it will just delete four lines above, right? So, yeah, that's the kind of stuff we need to know over here. this is why relative line numbers are useful in terms of win win motions but anywhere outside whim relative line numbers are just weird honestly like you have no idea what they're even used for so yeah just a little insider's whim job i guess um um hold on h and then the configuration name to get the documentation okay column name column h and let's say expand tab and this will give us the help okay okay use the appropriate number of spaces to insert a tab four obviously right how much is this supposed to be this better be four okay quit that window alright manually create the undo dir and specify the path to be created elsewhere okay so we need to create the undo dir which is going to be in where did I put it I put it in outside of this place in init yeah i can find it uh okay in nvim slash undo all right so we create that folder i guess which is going to be in here mkdir undo file exists oh So I guess it probably just created it on its own, right? When I first ran this NeoWim with this configuration. I guess it automatically created it for me. All right. What's next? Keymap.set. And this is just a bunch of shortcuts, I guess. I don't think we need to have these for now. Because one, I don't understand what this is even doing. And two, I don't know the syntax for all of this. and three we don't need any of this to get started so i'm going to skip this part but yeah you know before i started this whole youtube thing i had no idea that speaking is so hard on your throat like i need to keep drinking water every 10 seconds but um what do we do next now syntax goes mode where we means visual and normal and so on you know there's like 17 different modes in vim or something most of which we don't even use like i don't know but there's a ton of different vim modes usually we only use visual insert normal um replace visual line there's that's another one and just yeah five or six different modes that's it we really don't need need to use any of the other ones um but yeah okay last block isn't really remember okay okay we don't need to do any of these yeah primogen and tj degrees these are two people who actually inspired me to start um playing around with neo women stuff so yeah yeah and he's also part of the neo women development team so that's probably a good thing i was lazy as my plugin manager okay as for all the plugins to come i recommend you to always check out the docs there's more info in there than whatever i might get to explain here got it all right so let's get lazy as my um i guess plugin manager as well and then we can do everything else. See, this is one of the things I don't like about NeoWim. It's because you need to combine all of these different third-party plugins and tools just to have a complete development environment, which Visual Studio Code gives us right off the bat, right? Now, yes, you do need to use extensions for a lot of things, but installing and configuring these extensions is so simple. Like you literally just open up the page, click install and you're done. Right. But in Neolim, you have to just go through all of these different loops. Like I know that each extension has its own configuration file that you need to write and you need to have all of these like configs for every single extension or third party tool you use. And it's just a headache to use. I think. I don't know that that's just the I don't know, the assumptions that I have in my mind right now. But yeah, we're using this for the first time and we'll see if it's actually usable or not. We'll see if NeoWim is only used by nerds who have no life outside programming or actual normal people can actually use this. We'll see. So, don't they have some sort of an installation section here or something? How do I install this? Okay, there we go. Installation. There we go. Okay. Check out lazy for installation. We'll do that. Awesome. Nasty sneeze. Okay, okay. echo std pad config what does this this do let's see open up neo whim okay so it just gives you the path for your config okay easy all right so we get config.lazy first which means that first I need to create on go into this directory and then create and whim or not create but go over here and actually require the file which is going to be con dot lazy there we go now we can save this we can create the actual lazy file lazy.lua and then we can open it up and now let's see so we have all of this code which i wonder what all of this does make sure to set up map leader and map local leader before loading lazy.nv so that mappings are correct okay so i don't know what this is all about but this is where we actually import lazy.nv got it map leader and map local leader why do you have two different leaders that makes no sense anyway um local lazy path when dot FN dot std pad data dot dot slash lazy slash lazy dot and whim if not when dot uv or vim.loop dot fs stat lazy path then local lazy repo equals https github.com slash ball case slash lazy dot nvim.kit local out equals vim dot fn dot system get clone. I guess this is going to run the command. Okay. Filter. Blob none. Branch stable. Obviously we don't want to get any cutting edge release that's not even tested yet or something. Lazy repo and then lazy path. and close this. Okay. And then if vim.v.shellError equals zero, then vim.api.envimEcho fail to clone lazy.nwim and then a new line and then the actual error message which is going to be the standard output from the command and then a warning message which is just press any key to continue, I guess. you need to exit okay there we go all right and got it perfect then whim.fn.get character whatever that does and then os.exit with one one is just a status code that tells you that program exited with an error right you'll probably like if you brand some sort of um programs in your in your terminal you've probably seen this before like program exited with status code one or status code zero and so on and so forth that's what that means okay Okay. Wim.opt.rtp.prepend. Not pretend. Prepend. LazyPath. Awesome. So then we need to set up the map leaders which we've already done in the actual init file. And then we just set up lazy.setup. spec equals import plugins. I guess this is where we actually import the plugins that we have. Configure any other settings here. See the documentation for more details. Color scheme that will be used when installing plugins. Haba, Max, whatever that is. I hope that looks good because that's what I'm going to use for now. Color scheme. How about max? Okay. And then checker. Automatically check for plugin updates. Yeah. That's obviously going to be useful as well. We're going to enable that. There we go. Awesome. I think that's all we need. So let's save this and open up NeoWim and nothing happened. Okay. So something is broken. let's see what happened over here so I'm pretty sure I copied everything correctly this is probably a syntax error because I haven't used this language before lazy okay that was wrong lazy.lua let's just copy all of this and that was not what I wanted to do. There we go. That is also what I not wanted to do. Why is this not copying? How do you copy something from WIMP? Copy, huh? But this is pretty cool. I didn't know we could use a mouse in here. Apparently you can also use a mouse inside the terminal That makes no sense but Yeah there should be a string but you missing the opening quote Oh okay Over here Got it Where am I? Okay, there we go. Now it should be fine, I think. Now it's just a blank statement. No specs found for module plugins. Okay. Go back over here. So this plugins is probably just a placeholder. I don't, like, probably just a placeholder. We need to actually install real plugins here, probably. Plugin spec. Plugin URL. Okay. directory to a local plugin custom bit URL where the plugin is hosted name for the plugin okay okay okay okay okay let's just ask jpd how to set this all up okay yeah sure give me the plugins dot Lua example as well Oh, alright. Import plugins. Oh, okay. So this plugins here is going to be a Lua file again. Okay, that makes sense, I guess. So I guess we create a plugins.lua file in here as well. And save that. they should then return something which will be an object i guess and inside here we can actually get some plugins so what is tree sitter i know tree sitter is very very popular in the neobim community but i don't know what it does Parse the generator. Okay, that makes no sense. NeoWim. Does it just provide syntax highlighting and nothing else? Jumping to definitions, finding references. We do need those things, obviously. Okay, so it's probably useful to have this. Let's just grab it. nvim-free-sitter slash nvim-free-sitter build equals ts-update and there we go. all right error again no specs found for module plugins okay um let's see and let's also give it the directory three over here and let's see what the problem is oh right right contact plugins got it so that's like we did it before right down here it's supposed to be fun plugins okay save that open up plugins again and there we go so this is now installing something and it's broken again now that makes no sense um okay let's try check help lazy uh-huh uh lower rocks hero rocks what does any of this mean um let's just quit this whole thing for now um how do i how do i update all of my plugins lazy neo win update plugins because clearly it didn't install fine right there was clearly an error over here so So, how do I update all my plugins in Lazy? Oh, okay. So, run Lazy update. All right. So, TreeSitter is installed, but I don't know if it's going to work. Let's open up any file. Lazy.google. Yeah, see? It didn't work. So, there is an error over here. Error detected while processing bug. Read post auto commands. That makes no sense. Let's see what is going on over here. I'll just copy all of this and post it in here. And try to understand what's going on. No parser for lower language. Oh, okay. So we do need to install parsers for different languages. All the common ones. Yeah, I probably need to get all the common ones. Because I work in so many different languages, right? Okay, so open up nvim again. Cs install all. And I guess we're going to have to wait a bit until it installs all of them. and then we'll see what comes next after this can't this give me like a progress bar or something oh there we go okay we said go i definitely use go a lot we're going to need this um yeah it would be useful if it gave me some sort of progress bar but okay i guess we can make do with just these messages over here uh in the meantime you can make tree setter auto install parsers oh ensure installed and highlight enable true what does that do ensure installed okay yeah i'll probably add this as well right just as soon as this finishes i guess Kotlin. I don't need Kotlin. I guess this is going to install a ton of unnecessary syntax highlighting as well, which we don't need. But I guess it's fine for now. We can probably just uninstall these and make sure to only install the ones that we need, like all of these over here. But, yeah. sure it's taking its time yeah most of these languages i'm not even going to use so this is kind of useless i guess super html what is that what is this html language server and templating yeah for some reason i thought this was a new html language i guess not okay tmux yeah tmux is something i want to try out as well um yeah Stream is going fine as well You can see I get zero views completely Just me, me, and me The whole stream While this finishes I'm going to take another water break Okay, it's almost done. Come on, come on, come on, come on, come on. Almost done. Is it stuck? I think it's stuck. Why is it not done yet? Why is it not done yet? I think it's... Oh, it is done. Okay. So it doesn't give you, like, a completed message or something. But now we should be able to open up any file and get syntax highlighting. There we go. Awesome. which means I should also be able to have something like close this, app.py, let's say a Python application, and I have os os. I forgot how the commands work. Let's just create a function, print hello. Yeah, see, we do get syntax highlighting here. Perfect. awesome okay so syntax highlighting works some of the configuration works we have not line numbers and everything okay uh my leader key the tab key that's not working yet so we need to fix that as well but yeah i think this is good enough for now to be honest i think this is enough neo-wim for today i'm gonna end the stream over here and we're going to continue configuring this probably tomorrow and yeah we'll see how that goes i want to make this my default editor like my main code editor but that'll probably take a while to set everything up and stuff but yeah that's it for now and yeah stopping the stream

Share this article

All great things started with a conversation

If you've got a cool project or opportunity and you want me to be a part of it, set up a free meeting with me here, and let's talk. 😊