You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4.4 KiB

Getting Started with Neovim/Lunarvim

Background Information

This guide will go over very surface-level stuff for lunarvim. It will covering installing neovim and then lunarvim. It will also cover very basic configuration options.

What is Neovim? Lunarvim?

Neovim is a "forked, more feature-rich version of [vim]". It utilizes lua to do its configuration, but vimscript also works just fine in it. In text editors like neovim and emacs, there aren't settings like how a normal IDE or text editor might handle configuration. This is a good thing and a bad thing. On one hand, it means that literally every part of the text editor is yours to configure. Once you are done with it, the text editor is your text editor. Rather than settings, you will make your changes to the editor with code. The bad thing about this is that it is more work, but that doesn't have to be a bad thing. It's only a bad thing if you let it become a bad thing. More on this later.

These configurations you make via code are called… configs. Think of LunarVim is a well put-together config, with a lot of features set up out of the box. It essentially moves a lot of the initial configuration away from you and into the hands of the lunarvim devs. That being said, it is still neovim and is still 100% configurable.

Why use a text editor like lunarvim?

Lunarvim is a great starter text editor because it sets you up to configure things the way you want with lots of documentation without having to focus on primitive features most text-editors already have like a file explorer or window tabs. Think about it like this: Have you ever wanted some really niche feature that most people wouldn't want? In something like VSCode, this is a hard sell. If the extension doesn't exist, you're welcome to try developing it yourself, but that's (in my opinion) an entire project all on its own. In something like neovim or emacs, your tiny feature has probably already been implemented by someone on the internet, and even if it hasn't, it's probably only a small snippet of code to make it happen. I also have to throw in the low hanging fruits of perks: speed, power, and portability.

Installing Neovim on ubuntu

sudo snap install nvim

One downside of ubuntu is snaps. They are a bait. They generally suck. They are slow. The security features are basically security theater. However, it is the easiest way to install a somewhat up-to-date version of neovim.

That's really it. I'm not sure why I made this a whole section.

Installing LunarVim

Before we install lunarvim, let's make one thing clear. Lunarvim is not a program. It's literally a super well-thought out config file. I cannot stress that enough because it is important!

AND before we install lunarvim, we should install some prerequisites. These aren't necessary, but you want them. I'm going to assume we already have pip installed. Let's install rust:

Why are we installing rust?

We are installing rust because it installs cargo, the rust package manager. We can use that to install rust programs and toolchains. The only rust program we really care about is ripgrep. Ripgrep is like grep, except ripgrep is, scientifically speaking, fast as f!^k. It will allow you to find keywords in extremely large projects insanely fast, if not instantaneously.

Installing rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME"/.cargo/env # this is just refreshing your environment so it sees the cargo binary

Installing Lunarvim

LV_BRANCH='release-1.2/neovim-0.8' bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/fc6873809934917b470bff1b072171879899a36b/utils/installer/install.sh)

The above snippet is from lunarvims official website: https://www.lunarvim.org/docs/installation If any dependencies are missing, it should tell you what you're missing.

What did this just do?

If you want to know specifically what we just did, open the install.sh file and inspect it! I will give a general overview if you don't want to do that: The install script is really well put together. It verifies that your neovim will work with lunarvim and then it installs lunarvim to ~/.config/lvim. It also installs dependencies (like ripgrep) through cargo, pip, and npm, though I opt not to use npm and say no to that during the install. Inside of your ~/.config/lvim folder, you'll find a config.lua file. That's your config!