Posts NeoVIM installation and setup guide
Post
Cancel

NeoVIM installation and setup guide

Neo Vim is a new generation VIM editor. It has beautiful UI.

Installation

  1. Download NeoVim:
1
wget https://github.com/neovim/neovim/releases/download/v0.10.0/nvim.appimage
  1. Install:
1
2
chmod +x nvim.appimage
mv nvim.appimage /usr/local/bin/nvim

Preset Configuration setup

  1. Download dotfiles from github and use stow command to link config:
1
2
3
git clone git@github.com:mrasif/dotfiles.git
cd dotfiles
stow nvim -t $HOME
  1. Remove pre installed config:
1
2
rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim
  1. Install downloaded config:
1
mv nvim ~/.config/
  1. Verify new directory location should be ~/.config/nvim where init.lua should present. Here is referance tree-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ tree ~/.config/nvim
nvim
├── init.lua
├── lazy-lock.json
└── lua
    ├── plugins
    │   ├── alpha.lua
    │   ├── catppuccin.lua
    │   ├── completions.lua
    │   ├── debugging.lua
    │   ├── git-stuff.lua
    │   ├── gitsigns.lua
    │   ├── lsp-config.lua
    │   ├── neo-tree.lua
    │   ├── none-ls.lua
    │   ├── nvim-tmux-navigation.lua
    │   ├── oil.lua
    │   ├── swagger-preview.lua
    │   ├── telescope.lua
    │   ├── treesitter.lua
    │   └── vim-test.lua
    ├── plugins.lua
    └── vim-options.lua

  1. Install language server
1
2
3
4
5
wget https://github.com/LuaLS/lua-language-server/releases/download/3.9.1/lua-language-server-3.9.1-linux-x64.tar.gz
mkdir /opt/lua-language-server
mv mv lua-language-server-3.9.1-linux-x64.tar.gz /opt/lua-language-server/
cd /opt/lua-language-server
tar -zxvf lua-language-server-3.9.1-linux-x64.tar.gz
  1. Setup environment, add this line to your .bashrc/.zshrc
1
2
export PATH=$PATH:/opt/lua-language-server/bin

  1. Install gopls
1
go install golang.org/x/tools/gopls@latest
  1. Open NVIM
1
nvim
  1. Add .env.nvim file to your project directory, which is environment variable files of your project, will be auto exported to your vim env.
  2. Use nvim command :Lazy to open lazy dashboard.
  3. Press Shift + I to install dependency.
  4. Install dlv debugger for golang development.
1
go install github.com/go-delve/delve/cmd/dlv@latest
  1. Install ripgrep for Telescope live grep.
1
sudo apt-get install ripgrep

Shortcut

Find shortcut:

  • Space + Space will open Old files finder.
  • Ctrl + p will open Find files finder.
  • Space + fg will open Live files finder.
  • Ctrl + n will open File Tree at Left
  • Space + bf will open floating buffered file tree.

Pane shortcut:

  • Ctrl + ww will move focus to next pane.

Debugging shortcut:

  • gb to add breakpoint.
  • gf to go next step.
  • gr to run debugger or continue.

coding shortcut:

  • Space + gd to go to description.
  • Space + gr to go to reference.
  • Shift + K to view quick code doc.
  • Space + gf to format code.
  • y to copy selected text to clipboard.
  • c to cut selected text and copy to clipboard.
  • p to paste from clipboard.