Post

Neovim Init Setup

Neovim

Neovim is a cli based text editor written in lua. It’s written in lua and is based on vim.

Use :q! to quit or :wq to write & quit btw.

Installation on Mac

1
2
3
4
5
#Using HomeBrew
brew install neovim 

#Verify the Installation
nvim -v

Configuring Lazy (Package Manager)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Setting up lazy.nvim
mkdir ~/.config/nvim && touch ~/.config/nvim/init.lua
echo 'require("config.lazy")' >> ~/.config/nvim/init.lua

mkdir ~/.config/nvim/lua/config && touch ~/.config/nvim/lua/config/lazy.lua

# Paste the following to the lazy.lua file
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

require("lazy").setup({
  spec = {
    { import = "plugins" },
  },
  install = { colorscheme = { "gruvbox" } },
  checker = { enabled = true },
})

Plugins and Customizations

1
2
3
4
#Clone my .dotfiles
git clone [email protected]:aaryanpoudel/.dotfiles.git
mv .dotfiles ~/
ln -s ~/.dotfiles/terminal/nvim ~/.config/nvim
This post is licensed under CC BY 4.0 by the author.