Transcript for:
Setting Up a Comprehensive Neovim Environment

in order to build a full-fledged development environment in neovim you have to spend hours no wait years configuring your setup step by step plug-in by plugin suffer at the hand of mysterious errors Bang Your Head multiple times go back to vs code then un install and cry yourself to sleep then and only then when you wake up you'll have a partially working setup that you can write a bunch of code in and tell everyone that you're a cool kid now that's what I've done for years but this is isn't the case anymore it's 2025 not only you have neovim core maintainers with Kickstart projects to jump start your own neovim Journey there are now full-blown neovim distributions already made neovim drro including all the bells and whistles with language servers themes Auto completions debuggers AI fuzzy Pickers honestly everything you can ask for and much much more but people still criticize this Overkill hidden configuration bloated how about you'd be the judge yourself because we don't all have years to wait and honestly if I had the luxury of neovim users nowadays I take it without blinking twice so here it is neovim from scratch to Absolute beast mode we'll install configure lunch and cover the power that lies within if you've been living under a rock for the past couple of years let me introduce you to Lazy a neim Dr meaning a wrapper around it that doesn't only come with a bunch of utilities and plugins but also carry is a huge range of optional extras these are updated on a weekly basis and have recently got a huge boost so let's jump in install it from scratch just so you see how easy the process is and how Wild the outcome if you have a current setup it's advisable to back it up by moving your config envm aside as well as local share local state andash envm directories since my config is committed to GitHub and lives in my DOT files the dot config is just a Sim link more about my DOT file set up in the video above I'm going to delete EnV from config and then as advised remove the local state and cache and other temporary files okay it's go time G clone lazy Vim starter to config SL envm and that's pretty much it there's a few files and a solid structure here that we're going to go through but for now let's just fire up neovim the first thing you're going to see is the lazy screen installing a bunch of plugins like buffer line kuchin theme FZ FLA G signs and other plugins that are almost considered a must these days obviously it's all opinionated but can be changed easily later for now let's let it finish then restart neim to see the effect and there we are if you look at the bottom quickly it says four out of 34 plugins are actually loaded thanks to Lazy doing what it does best lazy loading plugins in the appropriate event leading to a blazing lad time of just 25 milliseconds I can tell you I've never reached that fast startup time time regardless of how well I thought I configured things okay so we have everything set up now let's take a step back and fire up yazzi to view some file structure don't worry there's a perfectly capable one that comes with lazy but we're taking it step by step so we have a one line in. Lua file that loads config lazy there's a famous Lazy Lock file that represents our plug-in State just like any other lock file you probably know now lazy. Json is where lazy gets interesting and while it's quite empty right now we're going to see it get filled up once we make changes under Lua you've got config deer for auto commands kaps and other D through options and plugins deer holding example. Lua file with Laz array of plugins which if you've already used lazy in the past maybe just as a package manager like I did this should look very familiar with that out of the way let's jump back in and show the magic while lazy V by default comes with a useful startup dashboard your first key for basically everything is leader key which in my case and most others is space hitting it once will pop the lazy command pet mapping keys from neot tree for file exploration through quick access to buffer switching down to sub menus for more buffer management options code utilities debugging options file git UI and many many more for example hitting f for file or find and I also added a key cast in the bottom left corner so you can follow along this pops the submenu for files here we can continue to our desired actions like e for neot tree Explorer which I can then use to explore the system like we've done with yai earlier as you can see buffer line on top indicates open buffers that we can later move between and use to work on multiple files if you're not sold on buffers yet and work with Windows check the video above which may change your mind the next most useful hotkey is lader space or simply space space for me which default to FC flua with a fuzzy file picker allowing me to get a quick glance into file structure like you may know from using telescope EnV don't worry telescope is also available here but it doesn't come as the default option which I'm not actually sure why in any event remember space starts the main command pallet space space and your files pop in a fuzzy picker if you ever need the lazy menu it's available as l in the menu so leader L Pops that up where you can update install Clean use all the lazy package manager features including following up on which plugins are currently loaded and which are not okay so we've got all that power in our hands with a single installation but what if I want to make some twixs you may have noticed that I was trying to switch insert to normal mode using JJ as I always do but naturally lazy V doesn't know about my very sensible setting which I don't understand why everyone doesn't just do anyway let's change some mappings lazy F already offers key maps. Lua so that we can have a place for these settings without wondering where it's best placed I'll split my screen to find my old K ups. Lua at my old files repository and for now I'll copy the JJ setting alone my first inclination was to copy the entire file but as with other setups I like to start fresh and consider I had probably accumulated unused mappings and bad habits just like my buffer key mappings here which are all mapped with a t prefix from the past where I was used to managing tabs instead restarting enm again and I don't know if the notifications above annoy you as much as they annoy me but luckily these are coming from FKS notifications which is also the author of lazy so we were blessed with a notification manager ler and youu opens the UI options allowing control of animations background color schemes and many other visual options including yes dismissing notifications with n so leader and you does the trick and whatever no ifications on the screen disappear immediately when it comes to buffers lazy comes with a bunch of options too many actually so pick one and roll with that you can pop a buffer Explorer in neot tree and while there are lots of options in the buffer menu I found myself using lader BB to go to the last buffer if you have more than two or would just like to scroll through existing buffers the default and super convenient mapping for that is square bracket and B to move to the previous or next buffer using opening or closing bracket respectively you may know brackets from using the great tpes VI impaired Plugin or the modern option mini bracketed which is also what's lazy VM using and I've covered specifically in the mini plugins video up here all of lazy V's default mappings can be of course found in a nice table in the docs and I suggest going through it at least once to see what resonates with you and match your workflow at this point after additions and other configs my lazy Vim stands on 40 millisecond startup time which considering everything it does so far is very impressive to me but I'm not done bells and whistles are nice but we need real life scenario so I'll open my actual work project where I'm building another kubernetes operator to support high-scale workloads and here's one of my go link based controllers which I'm adding some code to but wait the syntax looks okay and it's highlighted but that's pretty much it I don't see any errors or sign of an LSP how about we solve that with lazy be well let's start by looking at the initial lazy plugins array that lazy VM comes with tritter is installed with lots of basic languages which explains some of the syntax highlighting and other code suggestions I've seen but goang is not only absent but I'm also missing a bunch of other plugins that I've been using as a newm goang environment and I want them time to look at Lazy vims extras from within the editor you can find it in the dashboard when lazy VM starts up or call Lazy extras at any point you'll see a pop-up window with lots of extras waiting to be installed as mini packages I'm even getting a short list of recommended options on top like the Json package markdown and toml for whatever reason and as you can see in blue every package contains a few plugins that work in tandem to create a language supporting environment let's look for goang and there it is l.go comes with Mason mini icons neot test dap for debugging and SSP config of course and many more under extras you'll find parent groups like AI Cod and others since we're after a goong environment I'll pop the Lang section revealing Endless Options from angular and anel for you old school devops guys through Docker Elixir heck even Nell scripts are supported I'll find go where we can see everything that's included together with the different configurations should we want to tweak these later for now back to Envy hit X to install to which lazy Vim responds with the feature being enabled and awaiting a restart let's follow W lead stuff are happening in the background and as soon as it's completed I can already see go PLS the language server pops an error for my badly positioned variable declaration just to refresh your memory mini bracketed here also supports any Diagnostics by using bracket in D or bracket in E if we want to scroll through errors specifically like I'm doing right here in addition to supporting goang with the LSP here's a nice addition I've never had showing the asserted variable type in line as ghost code like here where X is assumed to be an integer Y is a string and Zed is a float similarly code suggestions here are added and help with autocompletion when I want to use my variables making things simpler and spinning up coding process now here's another mapping I've never used saving files had always been double capital W for me where lazy comes with a nicer option of using contrl S like save I'm only showing the option here just to highlight another feature where upon saving the code everything is formatted so so indentation is fixed and in my case empty lines are removed altogether I want to stress out again how important it is to go through the list of mappings where I found gems like the mapping for creating a comment above or below line using GCO or GC capital o or get this leader ft to pop a terminal with a current working directory just like you do with your typical ID now that's not my style and I rather use t-x for that or better yet my t-x plug-in flow to pop a floating terminal but nevertheless it's a valid option and if you're curious about all the terminal options when working with new check out the video above which I made especially for that moving on with switch Gams of lazy Vim check out the scratch buffer that pops with liter and Dot allowing you to test piece of code on a scratch pad without abusing your Project's files and look how the LSP generates code completion for an entire web server responding to my hello function this isn't AI you see here it's your code suggestion and don't worry we'll get to AI lazy fim supports all your favorite code agents just as well but before that for those of you who are wondering what about git operations and yes I have the video up here covering all your git options but lazy simplifies life lader G for git where there's git blame browse commits status and lazy git now while I never use neot tree as my personal preference for G status I find it to be quite nice to use keeping the same visual theme of lazy Vim it pops in a similar fuzzy picker window like the file explorer and staging un staging files is as easy as moving them to the left or the right as well as resetting them and other operations now is this better than having my beloved neit replaced with other mainly viewing options I mean GC which I've always been using as git commit now suddenly pops a window with Git commits like a log I'm not sure about that yet but to cover for that as mentioned lazy Vim has a hammer into ated to solve all your git needs and more lazy git surprisingly not developed by folk is one of if not the best git terminal interfaces and it's now officially integrated into lazy V this way staging committing searching through history or branches is all doable from one central location which if I'm honest makes an amazing experience now if lazy git is good enough for DH which actually came on lazy gits author show speaking about how he enjoys the tool it's sure as had good enough for me with everything that lazy Vim comes with the ease of adjusting it to my needs which as you've seen is close to zero makes me want to keep it that way and don't go all too crazy with custom configurations it already comes with my favorite plugins integrated to its core like mini Pairs and mini Ai and no not that AI just a better text objects list what I'm saying is lazy them is the full package almost no sacrifices not in capabilities and surely not in performance now I still see variability in startup times this one took 29 milliseconds so let's load up a few more extras you all been wondering about this time it's like a candy shop I'm getting everything I want markdown check MINI surround check MINI files you're about to see real power check adjacent package sure check Helm files sure I come from devops after all let's throw that into yaml too because how else will I be able to enjoy kubernetes and while lazy is installing everything now you you can see the added key mappings in purple for example for surround they all start with G not my personal preference and a great place to present how we can make changes to a plug-in mapping in the right way so that they reflect in the menu of options too so we've Nim loaded again and notice that it's now in 27 millisecond load time thanks to Lazy nothing major had changed when all these new additions stay unloaded let's open up some files like a good kubernetes yaml to show yaml based LSP errors which if I'm I'm honest I've never seen or bothered with before it's super cool and helpful especially for a karst developer like myself remember I promis some real power check Min files one of my favorite recent discoveries since it's added as a lazy extra it also shows up in the menu if you hit f for files we now have M for mini mini files for those of you who aren't familiar is a file manager letting you control files by deleting renaming adding and viewing like all. EnV or some of the neot tree capabilities just better let's use it to see how to add the plugins mapping following best practice I'll add a new file under plugins called surround Lua once ready hit the equal key and approve the action to create a new file that's it surround Lua is ready let's follow the config options I'm heading over to lazy vmd and under configuration recipes there's the surround options we'd like to change these can leave in the example a file that lazy come with or as a new file which is how I like keeping things easier to find and work with we'll return the object per Lu conventions and now instead of using GSA to add which as you can see GS a i w meaning in word and then any sign will wrap the word I'd like to change G to my lader key now leader essay pops a menu of surround options how cool is that you can surround a line next or previous word character and more let's also change the delete action to use leader and show why I love mini plugins so much check out the cool next object allowing for leader SD and Q calling for surround delete and Q for quotes stripping any kind of quotes from the word I'm working on there are more options which I enjoy a lot like taking action on the next finding or previous but we're not here for text object check out the description or my channel for the video covering that meanwhile Docker files get their own LSP with code suggestions error Corrections and other options previously only reserved to real languages needless to mention commenting code up until recently a plugin you had to bring on your own comes here integrated as core essential remember that lazy v. Json file we've seen upon installation well look at it now with all the extras added to it tweaking the configuration and following versioning of config that has changed before wrapping things up I know many including myself are wondering about Ai and how it integrates in should you get your own code completion what if you prefer copilot over codium or your own model since GitHub copilot is free now I'm happily going back to integrating it so let's first add this as a lazy Vim extra under api. copilot entry which also comes with autocompletion and other supporting plugins with that installed the integration process is rather simple just follow the URL and use the onetime code authorized integration and that's pretty much it now with a simple comment saying let's create a function that grabs all the pods from the cluster co-pilot introduces a new reconciler function which if you've been working with kubernetes operators you can see how the model picks up the context in which it should work and doesn't only create a function but also builds it correctly according to how the controller Works lastly lazy comes with many many settings that you can change to persist or on the Fly Like heading over to the UI section with leader and U and then enabling cool features like dimming with capital D that keeps only focused bits of code in your eyes you may know this feature from another Famous folk plugin called sen mode which is also optional from within lazy VI what I'm trying to say is you can use lazy Vim as is and as you've seen it works out of the box but there's a lot to explore key mappings extras additional configurations of core setup and more under the util section there's project management addin Oto do files gei rest client and many others there we are now you're ready to go but NE is just one element of mastering workflow combined with t-x the two are unstoppable so make sure you have t-x from scratch to propel yourself into the world of terminal multiplexing controlling your way Beyond just an IDE with these two combined you really are a cool kid thank you for watching and I'll see you on the next one