Skip to main content

Leader key

The leader key is set to Space:
vim.g.mapleader = " "
vim.g.maplocalleader = " "
All custom keybindings use <leader> (Space) as the prefix.

Essential keybindings

Line navigation

H  - Jump to start of line (^)
L  - Jump to end of line (g_)

Buffer navigation

<Right>  - Next buffer
<Left>   - Previous buffer

Search navigation

n  - Next match (centered)
N  - Previous match (centered)
*  - Search word under cursor (centered)

Quickfix navigation

<M-j>  - Next quickfix item
<M-k>  - Previous quickfix item
<M-q>  - Open quickfix list

Editing

1

Moving lines

In visual mode, move selected lines up or down:
J  - Move lines down
K  - Move lines up
2

Indenting

Visual mode indentation that maintains selection:
<  - Indent left (maintains selection)
>  - Indent right (maintains selection)
3

Split line

Split line at cursor position:
X  - Split line (maintains indentation)
4

Delete without yank

Delete without copying to clipboard:
d  - Delete without copying
D  - Delete to end of line without copying
Regular delete operations are mapped to the black hole register. Use cut or visual+yank for clipboard.

LSP features

Language server features are available automatically when a language server is attached:

Code actions

<leader>ca  - Show code actions (normal or visual mode)
<leader>cl  - Run code lens actions
Code actions use tiny-code-action for a minimal, fast interface.

Diagnostics

[d  - Previous diagnostic
]d  - Next diagnostic

Call hierarchy

<leader>ci  - Show incoming calls (who calls this)
<leader>co  - Show outgoing calls (what this calls)

Git workflow

Gitsigns (hunk operations)

Neogit (interactive git)

<leader>gn  - Open Neogit status
<leader>gc  - Open commit dialog
Inside Neogit, press ? to see all available commands. Common operations:
  • s - stage/unstage
  • c - commit menu
  • P - push menu
  • F - pull menu
  • z - stash menu

CodeDiff (diff viewer)

Basic diffs

<leader>dd  - Toggle diff explorer
<leader>df  - Diff current file vs HEAD
<leader>gD  - Diff buffer vs HEAD (split)

History

<leader>dh  - Full repository history
<leader>d.  - Current file history

Branch comparison

<leader>dm  - Diff vs origin/main (merge-base)
<leader>dM  - Diff vs custom branch

Search and replace

<leader>sR  - Open search/replace interface
<leader>sW  - Replace word under cursor
<leader>sF  - Replace in current file
<leader>sv  - Replace visual selection (visual mode)
1

Open grug-far

Press <leader>sR to open the search interface.
2

Enter search term

The interface starts in insert mode. Type your search pattern.
3

Preview results

Results appear as you type (debounced by 500ms).
4

Enter replacement

Move to the replace field and enter your replacement text.
5

Execute replace

Review changes and execute the replacement.

Treesitter text objects

Treesitter provides semantic code navigation:

Text objects

af  - Around function
if  - Inside function

# Navigation
]f  - Next function start
]F  - Next function end
[f  - Previous function start
[F  - Previous function end
Example: daf deletes entire function, vif selects function body.

Incremental selection

<leader>ss  - Start selection
<leader>si  - Increment selection (expand to next node)
<leader>sc  - Increment to scope
<leader>sn  - Decrement selection (shrink)
Start with <leader>ss, then repeatedly press <leader>si to expand selection to larger syntax nodes.

File operations

Utilities

<leader>rc  - Reload current file (:source %)
<leader>x   - Execute current line as Lua (normal mode)
<leader>x   - Execute selection as Lua (visual mode)
<leader>cp  - Copy file path with line number

Terminal

<Esc><Esc>  - Exit terminal mode

Floating windows

<C-w>f  - Focus first floating window
gX      - Open link under cursor (system default)

Completion

Completion is powered by blink.cmp with ghost text:
<Tab>    - Accept completion / Next item
<S-Tab>  - Previous item
<C-j>    - Next item (alternative)
<C-k>    - Previous item (alternative)

Configuration options

Key editor settings configured in lua/config/options.lua:
-- Indentation
vim.opt.expandtab = true      -- Use spaces, not tabs
vim.opt.shiftwidth = 4        -- 4 spaces per indent
vim.opt.tabstop = 4           -- Tab displays as 4 spaces

-- UI
vim.opt.number = true         -- Show line numbers
vim.opt.relativenumber = true -- Relative line numbers
vim.opt.cursorline = true     -- Highlight current line number
vim.opt.signcolumn = "yes:1"  -- Always show sign column

-- Search
vim.opt.ignorecase = true     -- Case-insensitive search
vim.opt.smartcase = true      -- Unless capital letters used

-- Editor behavior
vim.opt.undofile = true       -- Persistent undo
vim.opt.updatetime = 400      -- Faster completion (default 4000ms)
vim.opt.timeoutlen = 1000     -- Wait 1s for key sequence
vim.opt.mouse = "a"           -- Enable mouse support

Common workflows

Workflow: Fix type errors

1

View diagnostics

Open diagnostics with <leader>q to see all issues.
2

Navigate to error

Use ]d to jump to next diagnostic.
3

Show details

Press <leader>de to see full error message.
4

Apply fix

Use <leader>ca for code actions if available.

Workflow: Refactor function

1

Select function

Position cursor inside function, press vaf to select entire function.
2

Extract or modify

Use LSP code actions (<leader>ca) or manually edit.
3

Format

Save file with :w - formatting happens automatically on save.

Workflow: Stage and commit changes

1

Review changes

Navigate hunks with ]g and [g. Preview with <leader>gp.
2

Stage hunks

Press <leader>ga on each hunk to stage, or <leader>gA to stage entire file.
3

Open Neogit

Press <leader>gn to open Neogit status.
4

Commit

In Neogit, press c for commit menu, then c again to commit. Or use <leader>gc directly.

Workflow: Search and replace across project

1

Open grug-far

Press <leader>sR or <leader>sW (for word under cursor).
2

Configure search

Enter search term, replacement, and optionally filter by file paths.
3

Review results

Browse results with folding support. Press <CR> to jump to location.
4

Execute replace

Follow on-screen instructions to replace all matches.

Tips and tricks

Disable command window

The annoying q: command window is disabled. Use :q to quit.

Line numbers in visual mode

Press <leader>ln in visual mode to copy highlighted line numbers.

Preview substitutions

Use :%s/foo/bar/g - live preview shows in split window.

Format on save

Formatting happens automatically when you save. No manual command needed.

Plugin-specific help

Most plugins have their own help and keybinding lists:
# Inside Neogit
?  - Show help

Health check

Run health checks to diagnose issues:
:checkhealth           # All health checks
:checkhealth vim.lsp   # LSP health
:checkhealth nvim-treesitter  # Treesitter health

Next steps

Customization

Learn how to customize keybindings and settings

LSP configuration

Configure language servers and add custom settings

Build docs developers (and LLMs) love