Skip to content

From NeoVim to LunarVim

Published: at 08:45 AM

From NeoVim to LunarVim

Guangzhou, China

Installation

Prerequisites:

  • Make sure you have installed the latest version of Neovim v0.9.0+.
  • Have git, make, pip, python, npm, node, and cargo installed on your system.
LV_BRANCH='release-1.3/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.3/neovim-0.9/utils/installer/install.sh)

Optional:

sudo npm install -g neovim tree-sitter-cli
pip install pynvim

Updating LunarVim

Inside LunarVim :LvimUpdate

Updating Plugins inside LunarVim :LvimSyncCorePlugins

From the command-line lvim +LvimUpdate +q

Post install

LunarVim uses icons from Nerd Fonts. If you don’t want to use them, set lvim.use_icons to false.

mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts && curl -fLO https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/DroidSansMono/DroidSansMNerdFont-Regular.otf

After installing your font, refresh your font cache:

fc-cache -f -v

Cheat Sheet

Keybinds

Exiting:

Navigating:

Line:

Document:

Operators:

Configuration

You can configure LunarVim by using the configuration file located in:

cat ~/.config/lvim/config.lua

Read the docs

Custom Keybinds

-- Move selected line with K or J
vim.keymap.set("v", "K",  ":m '\<-2\<cr\>gv=gv")
vim.keymap.set("v", "J",  ":m '\>+1\<cr\>gv=gv")

-- Scroll with ctrl-d and ctrl-j while keeping centered
vim.keymap.set("n", "\<C-d\>",  "\<C-d\>zz")
vim.keymap.set("n", "\<C-u\>",  "\<C-u\>zz")

-- Find next with n and N while keeping centered
vim.keymap.set("n", "n",  "nzzzv")
vim.keymap.set("n", "N",  "Nzzzv")

-- Use system clipboard when copying with SPACE+y
-- You may need to install xclip (X11) or wl-clipboard (wayland)
vim.keymap.set("n", "\<leader\>y", "\"+y")
vim.keymap.set("v", "\<leader\>y", "\"+y")
vim.keymap.set("n", "\<leader\>Y", "\"+Y")

Python

Configure LunarVim for Python development:

lvim.builtin.treesitter.ensure_installed = {
  "python",
}
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup { { name = "black" }}
lvim.format_on_save.enabled = true
lvim.format_on_save.pattern = { "*.py" }
local linters = require "lvim.lsp.null-ls.linters"
linters.setup { { command = "flake8", args = { "--ignore=E

203" }, filetypes = { "python" } } }
From NeoVim to LunarVim

Other

:TSInstall json
:TSInstall javascript
:TSInstall typescript
:TSInstall tsx
--move selected line with K or J
vim.keymap.set("v", "K",  ":m '\<-2\<cr\>gv=gv")
vim.keymap.set("v", "J",  ":m '\>+1\<cr\>gv=gv")

--scroll with ctrl-d and ctrl-j while keeping centered
vim.keymap.set("n", "\<C-d\>",  "\<C-d\>zz")
vim.keymap.set("n", "\<C-u\>",  "\<C-u\>zz")

--find next with n and N while keeping centered
vim.keymap.set("n", "n",  "nzzzv")
vim.keymap.set("n", "N",  "Nzzzv")

--use system clipboard when copying with SPACE+y
--you may need to install xclip (X11) or wl-clipboard (wayland)
vim.keymap.set("n", "\<leader\>y", "\"+y")
vim.keymap.set("v", "\<leader\>y", "\"+y")
vim.keymap.set("n", "\<leader\>Y", "\"+Y")
lvim.builtin.treesitter.ensure_installed = {
  "json",
  "javascript",
  "typescript",
  "tsx",
}