LunarVim Cheat Sheet

LunarVim is a highly extensible, community-driven Neovim configuration with built-in plugins and features. Here’s a cheat sheet with some common LunarVim commands and configurations:

Installation

  • Clone the LunarVim repository:
git clone https://github.com/ChristianChiarulli/LunarVim ~/.config/nvim
  • Install dependencies using the provided script:
cd ~/.config/nvim
./install.sh

Basic Navigation

  • Switch between buffers:
    • :bnext or :bn – Go to the next buffer.
    • :bprev or :bp – Go to the previous buffer.
    • :b <buffer-number> – Go to a specific buffer.
  • Toggle NERDTree (file explorer):
    • Ctrl + n – Toggle NERDTree on/off.

Editing Text

  • Comment/Uncomment lines:
    • gcc – Toggle commenting for the current line.
    • gc – Toggle commenting for a visual selection.
  • Indentation:
    • >> – Indent the current line.
    • << – Unindent the current line.

Search and Replace

  • Search and replace:
    • :substitute/old/new/g – Replace all occurrences of “old” with “new”.
  • Search in files:
    • :Telescope find_files – Search for files.
    • :Telescope live_grep – Search for text in files.

Window Management

  • Splitting Windows:
    • :vsp – Open a vertical split.
    • :sp – Open a horizontal split.
  • Navigating between windows:
    • Ctrl + w + h/j/k/l – Move to the left/down/up/right window.

Git Integration

  • Git Blame:
    • :Gblame – Open a Git blame window.
  • Git Status:
    • :Gstatus – Open a Git status window.

Markdown Preview

  • Toggle Markdown Preview:
    • :MarkdownPreviewToggle – Toggle the Markdown preview window.

Code Navigation

  • Go to definition:
    • gd – Go to the definition of the current symbol.
  • Find references:
    • gr – Find references to the current symbol.

LSP (Language Server Protocol)

  • Hover over symbol for information:
    • K – Hover over the symbol to see documentation.
  • Rename symbol:
    • gR – Rename the current symbol.

Custom Configuration

  • Custom configuration file:
    • Edit the lv-config.lua file to add or modify configurations.

Update LunarVim

Update LunarVim:

cd ~/.config/nvim
git pull origin master

Update plugins:

:PackerSync

This cheat sheet covers some basic commands and configurations in LunarVim. For more detailed information and advanced configurations, refer to the official LunarVim documentation.