Skip to content

I. Getting Started

kate edited this page Jun 1, 2024 · 3 revisions

prev | next

This will be my guide on configuring Neovim. I've just started using it, so I'll try to update this as I go.

Prerequisites

  • Some Linux distro (I'm using Arch).
  • Basic Neovim knowledge (I'd recommend Neovim's vimtutor, that's how I learned the basics)
  • Some programming (mainly Lua) knowledge

Install

Go here for Neovim's guide on installation. Only configuration will be guided mainly here, though.

Configuration

Let's go through the configuration!

Default configuration folder

Neovim's default config folder is at $XDG_CONFIG_HOME/nvim/init.vim, which is usually at ~/.config/nvim/init.vim. However, for this tutorial, I don't want to mess with my personal dotfiles, so I'm using this is my ~/.zshrc (basically just ~/.bashrc):

alias nvg="nvim -u ~/neoguide/init.vim"

Troubleshooting: What if it doesn't exist?

Just make the folder! If your configs still aren't updating, run nvim, and run the command :echo stdpath('config'). That should be where your configuration folder is!

Plugins

We'll mainly be using vim-plug (and later on mason) for this guide.

vim-plug installation

Run this command in your terminal:

sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

Now, let's make our init.vim file! Copy in the following text:

call plug#begin()
" Put all your `Plug <x>/<y>` statements here!

call plug#end()
" Put all your `lua require('<xyz>') statements here! Make sure to include the following too:
lua require('init')

Now, run the following commands outside of Neovim:

mkdir lua && cd lua

Then, edit init.lua with nvim init.lua to contain the following:

require("mason").setup()

Then, add in the following into the plug area of init.vim:

" Let's add Mason for LSP
Plug 'williamboman/mason.nvim' 
" and TreeSitter for highlighting
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

Then, run the command :PlugInstall in Neovim. You should see TreeSitter and Mason be installed.