Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
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.
1LV_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:
1sudo npm install -g neovim tree-sitter-cli2pip install pynvimUpdating 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.
1mkdir -p ~/.local/share/fonts2cd ~/.local/share/fonts && curl -fLO https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/DroidSansMono/DroidSansMNerdFont-Regular.otfAfter installing your font, refresh your font cache:
1fc-cache -f -vCheat 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:
1cat ~/.config/lvim/config.luaCustom Keybinds#
1-- Move selected line with K or J2vim.keymap.set("v", "K", ":m '\<-2\<cr\>gv=gv")3vim.keymap.set("v", "J", ":m '\>+1\<cr\>gv=gv")4
5-- Scroll with ctrl-d and ctrl-j while keeping centered6vim.keymap.set("n", "\<C-d\>", "\<C-d\>zz")7vim.keymap.set("n", "\<C-u\>", "\<C-u\>zz")8
9-- Find next with n and N while keeping centered10vim.keymap.set("n", "n", "nzzzv")11vim.keymap.set("n", "N", "Nzzzv")12
13-- Use system clipboard when copying with SPACE+y14-- You may need to install xclip (X11) or wl-clipboard (wayland)15vim.keymap.set("n", "\<leader\>y", "\"+y")16vim.keymap.set("v", "\<leader\>y", "\"+y")17vim.keymap.set("n", "\<leader\>Y", "\"+Y")Python#
Configure LunarVim for Python development:
1lvim.builtin.treesitter.ensure_installed = {2 "python",3}1local formatters = require "lvim.lsp.null-ls.formatters"2formatters.setup { { name = "black" }}3lvim.format_on_save.enabled = true4lvim.format_on_save.pattern = { "*.py" }1local linters = require "lvim.lsp.null-ls.linters"2linters.setup { { command = "flake8", args = { "--ignore=E3
4203" }, filetypes = { "python" } } }
Other#
1:TSInstall json2:TSInstall javascript3:TSInstall typescript4:TSInstall tsx1--move selected line with K or J2vim.keymap.set("v", "K", ":m '\<-2\<cr\>gv=gv")3vim.keymap.set("v", "J", ":m '\>+1\<cr\>gv=gv")4
5--scroll with ctrl-d and ctrl-j while keeping centered6vim.keymap.set("n", "\<C-d\>", "\<C-d\>zz")7vim.keymap.set("n", "\<C-u\>", "\<C-u\>zz")8
9--find next with n and N while keeping centered10vim.keymap.set("n", "n", "nzzzv")11vim.keymap.set("n", "N", "Nzzzv")12
13--use system clipboard when copying with SPACE+y14--you may need to install xclip (X11) or wl-clipboard (wayland)15vim.keymap.set("n", "\<leader\>y", "\"+y")16vim.keymap.set("v", "\<leader\>y", "\"+y")17vim.keymap.set("n", "\<leader\>Y", "\"+Y")1lvim.builtin.treesitter.ensure_installed = {2 "json",3 "javascript",4 "typescript",5 "tsx",6}Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.