life is too short for a diary

Neovim Setup with LunarVim

Tags: vim neovim lunarvim

I am an ardent vim user. A forked version of vim called neovim recently caught my attention. It has more features like support for language server protocol that provides auto-complete, etc. LunarVim provides neovim configuration files so that it behaves as an IDE.

As of today (May 14, 2022), Lunarvim requires Neovim v0.7 or higher. So we will install neovim from the source to get the latest version.

Install neovim

$ sudo apt-get install libtool libtool-bin m4 automake cmake gettext ninja-build autoconf g++ pkg-config unzip curl
$ git clone
$ cd neovim
$ git checkout stable
$ make CMAKE_BUILD_TYPE=Release
$ sudo make install
# If  error on previous command
$ sudo make distclean; make

You can verify version of neovim

$ nvim --version
NVIM v0.7.0
Build type: Release

Install tree-sitter features like syntax highlight

$ git clone
$ cd tree-sitter-fusion
$ yarn install

If you get error as Yarn install command error No such file or directory: 'install' then

$ sudo apt remove cmdtest

$ npm -g install yarn

Install packer.nvim

$ git clone --depth 1\

Install LunarVim

$ LV_BRANCH='release-1.2/neovim-0.8' bash <(curl -s

Or go to the website to get latest installation command.

To fetch the latest changes for lunarvim

$ cd ~/.local/share/lunarvim/lvim
$ git pull

Or by commandline

$ lvim +LvimUpdate +q

You can start using Lunarvim using

$ lvim

Enable 'Copy to Clipboard'

If you are using wsl on Windows, copy to clipboard might not work automatically. To fix that -

  1. Go to and download the latest Releases, for example -
$ curl -sLo/tmp/
$ unzip -p /tmp/ win32yank.exe > /tmp/win32yank.exe
$ chmod +x /tmp/win32yank.exe
$ sudo mv /tmp/win32yank.exe /usr/local/bin/
  1. Add the following line to the file ~/.local/share/lunarvim/lvim/init.lua
vim.cmd("set clipboard=unnamedplus")

Now you can copy using the following command


Additional tweeks

  1. Add the following line to the file ~/.local/share/lunarvim/lvim/init.lua
vim.cmd("set foldmethod=indent")
vim.cmd("set foldlevel=0")
vim.cmd("set ai")

--stop auto indent
vim.cmd("set indentexpr=")

--zoom in and out
vim.cmd("noremap z2 <c-w>_ \\| <c-w>\\|")
vim.cmd("noremap z1 <c-w>=")

vim.cmd [[
    set tabstop=4
    set shiftwidth=4
    set softtabstop=4
    set backspace=indent,eol,start
    set expandtab
    set autoindent
    set smarttab
    set encoding=utf-8
    set incsearch
    set hlsearch

-- remove trailing whitespace --
function stripTrailing()
    local l = vim.fn.line(".")
    local c = vim.fn.col(".")
    vim.api.nvim_command("call cursor(" .. l .. ", " .. c .. ")")

vim.api.nvim_command("autocmd BufWritePre * lua stripTrailing()")
  1. Supress diagnostic warnings by adding the following to lua/lvim/lsp/handlers.lua.
  local diagnostic_opts = {
    underline = true,
    virtual_text = false, -- this it what you're looking for
    signs = false,
    update_in_insert = true,

    vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, diagnostic_opts)


Error detected while processing VimEnter Autocommands for "*":
Error executing lua callback: .../.local/share/lunarvim/lvim/lua/lvim/core/treesitter.lua:185: VimEnter Autocommands for "*":
 Vim(lua):Installation not possible: Parser not available for
 language "vimdoc"


cd ~/.local/share/lunarvim/site/pack/packer/start/nvim-treesitter/
git pull origin master
Error executing lua:


:TSInstall all

comments powered by Disqus