Alright, so you might think that there are better ways to spend your Easter break than sitting all of your evenings customizing Neovim with no prior knowledge. You’re probably right. Sceptics may also say that I’ve reproduced VSCode instead of simply using it. They are also probably right. Or are they? 🤔
First of all, why learn Vim?
I am a big lover of keyboard and a great hater of a mouse or touchpad. The major reason for those extreme emotions is mainly caused by my (maybe superstitious) need to work as effective as possible. I feel like moving your hand from the keyboard to the mouse every time you want to move the cursor a few words back or forth, to create a new file, split the window or whatever, is a major waste of time. The problem with VSCode or any other graphical editor is that the necessity to use a mouse is encoded in the design of those applications. I tried using this Vim extension for VSCode, but it felt clunky and I couldn’t get used to it (the same goes for Vim browser extensions, but that’s a different story).
My frustration with GUI IDEs had grown for some time. I used Vim only for some small, fast changes, but I did know only a couple of hotkeys, so I didn’t use it in any serious coding sessions. I had been scared of learning Vim for a long time, but one day I decided to just use it and learn it on the fly. And that was a hecking good idea.
How did I learn Vim?
I think that vimtutor was a major drawback for me in learning Vim. That kind of learning feels artificial and I didn’t feel I got any value after completing it. My method was more organic in a sense. I’ve found some nice site with a nicely formatted cheat sheet of Vim shortcuts, printed it and hung it over my computer screen and just used Vim all the time. If I wanted to perform some action that I thought can be done neatly using some keyboard shortcut, I just scanned the list searching for an appropriate hotkey. I think that this approach is great. I’ve quickly memorized the shortcuts that were frequently needed and then it was quite easy to get used to some other, not so often, but equally helpful commands.
If you’ve also thought about trying Vim but felt like the entry-level is too high, then I seriously recommend trying this approach. If you restrain yourself to use it then I’m pretty sure that after a few days you’re gonna love Vim and appreciate it even more. Now, I’m not an expert, but still, I feel that with the basic knowledge I can do magic that was impossible for me in VSCode or any other GUI editor I used.
Neovim takes it to another level
I must admit, bare Vim with only the basic options it offers is still inferior to a GUI editor like VSCode (but I know some people that disagree). I like the idea of a file-searching engine, language server, session and project management, drop-down windows, file tree and many other features. Fortunately, those concepts are very well suited to a text-based editor like Vim. They’re just not there out of the box. This is where Neovim comes to play.
It’s important to note, that I’m no expert. Some Vim veterans may argue that Neovim is redundant bloatware and they may have some point. However, I feel that Neovim have some significant advantages over Vim:
- It’s developed by many contributors, whereas Vim is in hands of one person (it’s not entirely true, but just look at the commit history for both of those editors, it speaks for itself)
- Neovim is an implementation of Vim focused on performance and customizability and you can feel it,
- Customization can be done entirely in Lua, which feels like a great alternative for Vimscript (which is ugly IMHO),
- Neovim is great out of the box.
The only place where Neovim loses with Vim is remote access – there’s only Vim available on a remote server in most cases, but that’s a minor disadvantage in my case.
Searching for some cool plugins and tweaking them was a very cheerful time and I run into almost no problems during the whole process. And, to be honest, 20 hours for creating a virtually full IDE from scratch customized entirely for your personal needs does not seem that much time at all. Lua is an easy and pretty language for configuration code, I think I’ve learnt it pretty well just by reading plugins’ code. I’ve also followed this awesome tutorial. It is great, modular and easy to follow.
Sounds great, but I don’t have time for this
Bullshit. Seriously, you probably have time to watch some junk content on YouTube or whatever you like to waste your time on (I do it too, but still, it’s most often a waste of time, one can rest better), but don’t have time to work a little bit longer for a couple of days? Just try it out, learning Vim is not as scary as it may look at the first glance. After you learn to use the shortcuts for some time you can move to Neovim and try configuring it. And if you feel like it’s too much of a bother for you, then maybe try LunarVim or Neovide, which are some prepared Neovim configurations. I haven’t use them, but they look sensible. I still recommend taking your time to configure it yourself though. You’re gonna have full control over your configuration and after some practice, it’s going to be ridiculously simple to tweak it further. If you want to look at my configuration, then head to my git page.
Plan of action – switching to Neovim as your primary editor
- Try learning Vim shortcuts first. Don’t use any custom installation, just bare vim with a sensible .vimrc, like this one:
"sets line numbering and relative line numbering set number relativenumber set shiftwidth=4 set tabstop=4 "expands tabs to spaces set set expandtab "highlight current line set cursorline "ignore case in searching set ignorecase "if mixed case in search then don't ignore it set smartcase "scrolling begins at 5th line from top or bottom set scrolloff=5 "sets syntax highlighting on syntax on encoding=utf-8 "Saves the position of screen at exit autocmd BufWinLeave *.* mkview "Restores screen last position autocmd BufWinEnter *.* silent loadview
- Have the cheat sheet close. Try using hjkl instead of arrows. Don’t use your mouse. Learn how to search and replace text. Abuse w, e, b. Use <number><action> to perform an action number of times, for example, 5j moves the cursor 5 lines down. Use every visual mode. Learn how to copy and paste.
- Move to Neovim. Install packer, try configuring it. Install some basic plugins. I recommend following this tutorial by crhis@machine.
What’s your view on Vim or Neovim? Did you try it and still prefer a graphical editor? Do you have a strong opinion that Emacs is superior to Vim? If you have any thoughts, don’t hesitate and comment under this post. I’ll be more than happy to hear your opinion.
11 thoughts on “Why I’ve spent my Easter break customizing Neovim”
looks cool 😎
though I struggle still to find reason to switch as:
– usage of unorthodox shortcuts (yy instead of ctrl+c?) seems like unnecessary friction. i’m afraid that the more you get used to these, the more lack of thereof will frustrate everywhere else i.e. in browser.
– vscode or anything else is still very usable with keyboard. For the rare actions I don’t know the shortcut for, I prefer to use mouse, rather than browse for the shortcut and use it once
also I felt intimidated by the various modes and switches between them. I guess this is the selling point?
– In a terminal environment, ctrl+c is something associated with sending SIGINT rather than pasting from the clipboard. Moreover, the clipboard is an idea that comes from graphical land, so IMHO it’s the opposite of “unorthodox”. You never use it in remote control for example (not for this purpose). And to be honest, I didn’t even think about it, it’s natural for me to use y in vim and ctrl+c elsewhere.
– I’m pretty sure that there is a ton of work you can do in vim with a simple hotkey that cannot be done easily in VSCode without a mouse, e.g. scrolling or moving through the text. Those aren’t “rare actions” either.
– I mean, there are 3 major modes and some minor additional modes that come very naturally when using vim (e.g. many visual modes). Is it that intimidating?
The unorthodox shortcuts and controls are a feature, not a bug.
Do you really think that is the best you can do as a highly specialized technician who works in code and text constantly every day? The same shortcuts used across every application no matter the context and workflow you are doing? You think the calculator shortcuts are also the shortcuts optimal for editing code, running test suites, scripting workflows, querying information, running command line commands?
Vim is a citizen of the terminal and integrates with a lot of the command line tools you are likely already using. with tmux and vim, you can have a really excellent development environment where you can seamlessly switch between the two.
Vim lets you switch between edit and navigation modes, and has shortcuts to navigate across entire code-bases quickly and without having to take your hands off of the keyboard. jkl; as navigation alone is hugely helpful.
VSCode is a nice tool, but it is not the only game in town. Some of us get annoyed by little inconveniences and it makes us happy and more productive to be able to spend a few minutes fixing them. This is where vim excels.
For example: i want to be able to browse files with a keyboard shortcut. With VSCode, there are shortcuts I can memorize. With vim, everything is a text buffer I can navigate using normal vim commands. This includes the “tree-view” file buffer on the left side of the screen. So i hop in there, and I can copy text, copy paths, and navigate it with those “jkl;” keys I spoke of before. it is very nice and very fast.
Yanking text preceded copy and paste. Makes total sense.
Vim has apparently caught up on some Neovim features such as :term, but I still use Neovim because I can always expect it to be fully-featured (in my experience, default vim installations in some distros are built without mouse/clipboard support).
A vim feature I use excessively is digraphs (:h digraph).
I use them to enter Greek letters, mathematical symbols, Latin letters with diacritics, Cyrillic…
The digraphs chosen aren’t always the most fortunate, but usually they aren’t hard to remember.
If any character is missing, it’s easy to add it to your config.
Some other favorite tricks: / to jump to the previous/next cursor location,
set virtualedit to easily draw ascii boxes in visual block mode.
Great blog post, one note: Neovide is not a neovim configuration but a config agnostic neovim gui. Another neovim configuration, in the vein of LunarVim, would be https://github.com/NvChad/NvChad
I am unable to clone your repository and get this error
git clone https://git.framal.xyz/nvim-configs.git/
Cloning into ‘nvim-configs’…
Fetching objects: 109, done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
Am I doing something wrong? I would love to have a VSCode type of experience with NeoVim
Hmm, I think I didn’t configure git correctly. Try cloning from github: https://github.com/korbiniak/framal-vim
Next up: Why i spent my summer holidays installing gentoo (systemd bad).
Are you a wizard? That’s exactly what I’ve planned, no joke