...
6 min readMy experience with Neovim
Using Neovim as the main editor or as a secondary editor might sound ridiculous, when there are plenty of other great and more modern editors, but there are also reasons why you should give it a try.
The software engineer veterans can tell you a lot about Vim and Neovim, as they have been using it for years, and most likely they will advocate for it.
My programming journey began with Brackets editor, then I started to use Sublime, a bit of Atom, and then finally VSCode, which I use till today. So it might look like I made a step back, in terms of my editor tools history, but I feel like I made a great step forward in my productivity.
Y'all probably know that kind of jokes
There are tons of jokes about Vim and how to exit it 😅. That's because Vim is a modal editor, which means that you have different modes, and you can do different things in each mode. Plus, Vim's navigation is based on the keyboard only, so you don't need to use your mouse. People not familiar with Vim - might find it hard to use it, but once you get used to it, you will be able to navigate and edit your text much faster.
Vim modes and navigation
I will not describe the Vim modes and navigation in detail here, as there are plenty of great resources on the internet, but I will give you a quick overview.
Vim has modes and you can switch between them. The most important modes are:
- Normal mode. It's the default mode. You can navigate through your text, and you can also delete, copy, paste, and do other stuff. Most keys are mapped to some action, not text insertion. The basic navigation is done with h, j, k, l keys, you can also use arrow keys, but I don't recommend it, as it's not natural and you will need to move your hand from the home row.
- Insert mode is for inserting or editing text.
- Visual mode is for selecting blocks of text, and then you can do some actions on the selected text.
- CLI mode: for executing commands. For instance, to exit it 😅 and save, select and replace text, etc.
- Replace mode is used for overwriting text. It's similar to insert mode, but it replaces the text instead of inserting it.
You can read more about Vim modes and navigation here.
Learning curve
Vim has a steep learning curve, but it's worth it. You can start with the basics, and then learn more advanced stuff. Once you get used to it, you will have a feeling that your fingers are flying over the keyboard, you are navigating, editing and replacing much faster and you do not need to use your mouse.
I would advise to start with adding the extension for learning Vim in VSCode. That will help you to get started with Vim, and you will be able to use Vim in VSCode. Then you can start using it with VSCode extension.
That's how I did that and started to use it. Of course, I already knew the basics - but never used Vim on a full-time basis for working with code.
Nvim editors and plugins
I believe that this is the greatest thing in Neovim. Nvim is a highly customizable editor, and you can configure it to your needs as you need.
There are plenty of plugins for Neovim, that can be easily installed via plugin managers like vim-plug or packer.nvim.
You are not tied to a specific folder structure or requirements, plugins can be installed in the way you want. You can also create your plugins, and share them with the community.
In other editors, a lot of things are integrated by default or you can easily install them as extensions.
I Neovim you will need to install and configure everything by yourself. For instance:
- You will need to install the LSP (Language Server Protocol) plugin nvim-lspconfig and then configure it for the language you want to use.
- Manually add linter and formatter
- File explorer
- Plugins for debugging, testing
- Status line
- Git integration
- Terminal integration (if you use the integrated terminal in your editor)
- Icons and Themes
and so on and so on.
So it feels more like you are constructing your editor :)
Of course, this might sound like a lot of work, but that's a lot of fun and a great feeling of ownership over your editor.
If you would like to save time, you can use already premade configurations like LunarVim, AstroNvim, Doom or any other. I use a slightly modified AstroNvim configuration, which I adjusted for my needs.
Is it a replacement for VSCode?
I would say that it depends on your needs. I use both of them daily and switching between them is not a problem for me. Although you can try to configure Neovim as much as possible closer to your main editor or IDE, it's still will be just a text editor, and it will not have all the great features that provide complete IDE or editors like VSCode.
For instance, I prefer to use VSCode when I need to resolve a lot of merge conflicts or when I work on a huge feature branch with someone else, thanks to git integration in VSCode I can see the messages from code reviewers directly in the editor, and I can resolve them much faster.
Conclusion
Even though might look like a Stone Age, I would recommend giving it a shot. It's a great editor, and it's worth it. It's increasing your productivity, and it's a lot of fun to customize it. Even if you won't use Neovim as editor, you won't regret vim motions. Vim motions are really great and changing completely the way how you write things. You do not even have to be a software engineer to use it, you can use it for writing your blog posts, or any other text. Software engineers can also get familiar with languages like Lua and VimScript.