Why Neovim is so much better than Vim now... (Neovim vs Vim)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you spend any time at all using Vim then there's a good chance that you might have also heard of this project called neovim and if you're like me for a long time I was confused what exactly is the difference between vim and neovim is neovim better than Vim do I need to switch from him and in this video I just want to answer those questions for you because I was confused for a long time so I'm going to go over the main differences between vim and neovama and finally my recommendations as to which one you should be using because the differences between vim and neovim aren't that apparent just out of the box but first before I get into this I need to give you a brief history lesson of what exactly neovim is so neovim is a fork of the original Vim as you can probably imagine now Vim is authored and maintained by one person called Bram mullinar and his position in the Vim project is that of dictator for life so whatever he says goes and whatever he doesn't say doesn't go so we can just even look at the commits here and we can see that all the commits inside Vim are committed by Bram mullinar himself and so he has total control about what is being added and what is not being added into vim and so if somebody else has an idea of the direction that they want to take Vim into and it doesn't align with his then it's just not going to happen and so neovim first came about because some people were frustrated with his leadership they wanted to add some features and they submitted a pull request and he just completely ignored them and so neovim was created as a fork of him and it's more Community Driven I guess you could say than Vim so if we're going to commits here then you can see that there's commits from all different kinds of people is not just one person and in the early years of neovim they were able to add a lot of features that just weren't present in the original Vim features like support for asynchronous actions and an embedded terminal inside of him but eventually Vim ended up adding those features as well so about two or three years ago if you were to ask about the big differences between vim and neovim I wouldn't really have been able to tell you much but over the past couple of years there have been a couple of significant changes to neovim that in my opinion really places it ahead of him and right now I think the biggest difference between vim and neovim is Lua support So as you may or may not know Vim uses this language called vimscript which was specifically made for Vim in order to handle its plugins and configuration and so if you've ever written a Vim RC then you probably know at least a little bit of Vim language and the problem with that is that vimscript was never that capable of a language it was cumbersome to work with it was missing some features and if you wanted to do some serious plug-in development then you would use an external language like Python and so you would have to bring in all these external dependencies and another problem is just that vimscript is slow and so what neovim did is they brought in a proper language called Lua which is a lot more powerful than vimscript and it's also baked into the editor so you don't have to bring in some external dependencies like Python and you might be wondering if I don't write any plugins why would I care about this and that's because even if you don't care about Lua even if you don't know any Lua at all the thing is if plug-in developers like rating in Lua then is going to be much easier to bring about a whole bunch of great new extensions using Lua and that's basically what has happened so there's this list here of a whole bunch of great neovim plugins and the thing is since these are written in Lua they just won't work with vanillavim and some of these plugins are in my opinion really game changing one neovium only plug-in that is really great is envym tree sitter well it can do a few different things but probably the most important thing will just be better syntax highlighting and so just at a basic level what you'll get is much richer syntax highlighting as you can see here and it has the ability to understand your code better and as such be able to highlight it better another very popular plugin is telescope.invim and what this is is it's basically a fuzzy finder and with it you can search through your your files your documents even the help docs if you want to and I find this plugin very useful as well those are a couple of very popular plugins but as I said you can look through this list for a whole bunch of other plugins a lot of them are very similar to some classic Vim plugins but they just have a lot more features and a lot more customizability and of course if you want to you can continue using all of your favorite Vim script extensions those will all still work properly so if you like the idea of having a lot more plugins to choose from that is something you may like about new of him another nice feature of new of him is it has built-in LSP support and you might be wondering what that is LSP stands for language server protocol and I think the best way to explain this would just be to show you so with LSP if you're working in a specific language let's say CSS and you want to get completions for that language or maybe documentation so you can write something like let's create a element here in CSS and something that you might like to type is background color and as you can see as I am typing something out I get a huge list right here of every possible thing that I could type in here so let's say in my case I wanted to select background color and then it's even giving me a giant list right here of everything that I can possibly select let's say I want corn flower blue that is right here so it gives you all kinds of different useful completions and Snippets I can also type something like let's say flex and in case you forget the syntax for it it will be right here on the side and you can see what exactly it does it will tell you in which browsers it's supported in and you will get information and completion like this in any language that you want but neovim just offers an interface for communicating with this server where it's pulling all this information from so if you actually want to download the servers you have to do that yourself so it does require a little bit of configuration for example I'm using this plugin called Mason which has a giant list of every possible language server that you could download so you can download one for typescript JavaScript anything else that you could possibly imagine it is all here and there are plugins that do something similar to this in vanillavim like for example coc.vim but since LSP is a native part of neovim it's going to be much faster and more efficient than a plug-in like that and so if you want an editor that can replace something like vs code then neovim is going to be a much better tool for that than vim and so those are the biggest differences that neovim has over Vim right now but let's be fair there are a few reasons why you might not want to use neovim and why you might want to use the standard Vim over neovim and that's because if you're sshing into different machines maybe you have to log into a lot of web servers and make changes inside there well they're obviously not going to be coming with neovim whereas Vim is basically everywhere so if you spend a lot of time working on web servers but don't want to have the switch between your neovim configuration and the Vim on the server then you might be better off just getting really familiar with vanilla Vim or maybe you don't really care about all of these plugins and LSP integration maybe you basically just use Vim as a text editor maybe you use no plugins or very few plugins in that case there really isn't as much of a reason to switch over some people want to turn their neovim into some crazy idea but if that's not you if you're happy with just a text editor and that's about it then Vim is fine you're not really going to be missing much but if what you like about Vim is the ability to extend it with plugins then I think that you will really like neovim and I would give it a try if I were you one last thing is that Vim is generally considered to be more stable than neovim neovim isn't exactly a bleeding edge technology but if you do want to use the latest version and experience all the latest features it is going to inherently be more unstable than just vanillavim now in practice I've never actually run into any issues using neovim I've never run into any weird bugs running the latest version of new of him but just be aware that that may be an issue and if you really care about stability more than anything then I would just stick with Vim porting over from Vim to neovim is very simple basically all you do is move your vimrc to NVM configuration folder and rename it init.vim what you can also do is you can even rewrite your entire Vim configuration in Lua you definitely don't have to but if you prefer working in Lua then you can do that and so this is my final review I would recommend most people to use neovim and if you're in one of those special use cases like I mentioned before then maybe stick with Bim but I think neovim will be perfect for most people and it'll continue improving all the time but if you haven't already give new of him a chance and you might fall in love with it like I did
Info
Channel: Eric Murphy
Views: 24,357
Rating: undefined out of 5
Keywords: vim, neovim, nvim, lua, init.vim, init.lua, vimrc, text editor, ide, vscode, vs code, vscodium, best text editor, vim vs neovim, vi, unix, linux, emacs, best editor, nano, learn vim, vim as an ide, lunarvim, telescope, treesitter, tree-sitter, lsp, language server protocol, autocomplete, completion, coding, programming, javascript, typescript, css, html, web development, 2023
Id: qQvFC0wRiRE
Channel Id: undefined
Length: 8min 57sec (537 seconds)
Published: Fri Feb 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.