From NeoVim to LunarVim
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:
:q
: Close file:qa
: Close all files:w
: Save:wq
/:x
: Save and close fileZZ
: Save and quitZQ
: Quit without checking changes
Navigating:
h j k l
: Arrow keys<C-U>
/<C-D>
: Half-page up/down<C-B>
/<C-F>
: Page up/down0
: Start of line$
: End of lineb / w
: Previous/next wordge / e
: Previous/next end of word
Line:
^
: Start of line (after whitespace)
Document:
gg
: First lineG
: Last line:{number}
: Go to line {number}{
: Jump to beginning of paragraph}
: Jump to end of paragraph
Operators:
d
: Deletew
: Motiony
: Yank (copy)c
: Change (delete then insert)>
: Indent right<
: Indent left=
: Autoindentu
: Undo<C-R>
: Redo
Configuration
You can configure LunarVim by using the configuration file located in:
cat ~/.config/lvim/config.lua
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" } } }
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",
}