Skip to content

Keybindings

Essential LazyVim keybindings for efficient editing.

Leader Key

The leader key is Space. Most LazyVim commands start with the leader key.

Press Space and wait to see available commands via which-key.

Norwegian Keyboard Considerations

On Norwegian keyboards, several keys used frequently in Vim are harder to reach:

Character Norwegian Key Vim Usage
[ Alt+8 Navigation (prev)
] Alt+9 Navigation (next)
` Shift+\ Marks
\ Alt+Shift+7 Some mappings
{ Alt+Shift+8 Paragraph motion
} Alt+Shift+9 Paragraph motion
~ Alt+K Change case

Add to ~/.config/nvim/lua/config/keymaps.lua:

-- Norwegian keyboard-friendly navigation
-- Use ø and æ for bracket navigation (they're on the home row!)
vim.keymap.set({ "n", "x", "o" }, "ø", "[", { remap = true, desc = "[ key" })
vim.keymap.set({ "n", "x", "o" }, "æ", "]", { remap = true, desc = "] key" })

-- This means:
-- ø + d = previous diagnostic
-- æ + d = next diagnostic
-- ø + h = previous git hunk
-- æ + h = next git hunk
-- ø + b = previous buffer
-- æ + b = next buffer

-- Alternative: Leader-based navigation (works without remapping ø/æ)
vim.keymap.set("n", "<leader>dp", vim.diagnostic.goto_prev, { desc = "Prev diagnostic" })
vim.keymap.set("n", "<leader>dn", vim.diagnostic.goto_next, { desc = "Next diagnostic" })

-- Navigate quickfix
vim.keymap.set("n", "<leader>qp", "<cmd>cprev<cr>", { desc = "Prev quickfix" })
vim.keymap.set("n", "<leader>qn", "<cmd>cnext<cr>", { desc = "Next quickfix" })

-- Navigate buffers without brackets
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
vim.keymap.set("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" })

-- Easier marks (backtick is hard to reach)
vim.keymap.set("n", "'", "`", { desc = "Jump to mark (exact)" })

-- Easier paragraph motion
vim.keymap.set({ "n", "x", "o" }, "Ø", "{", { desc = "Prev paragraph" })
vim.keymap.set({ "n", "x", "o" }, "Æ", "}", { desc = "Next paragraph" })

Why ø and æ?

On Norwegian keyboards, ø and æ are:

  • Located on the home row (right pinky)
  • Rarely used in programming
  • Single key press vs Alt+8 / Alt+9
  • Natural left/right association (ø is left of æ)

This mapping lets you use all bracket-based navigation naturally.

General

Key Action
Space+Space Find files
Space+, Switch buffer
Space+: Command history
Space+/ Search in project (grep)
Esc Clear search highlight
Ctrl+S Save file
Space+Q+Q Quit all

File Operations

Key Action
Space+F+F Find files
Space+F+R Recent files
Space+F+N New file
Space+F+T File explorer (focus)
Space+E File explorer (toggle)

Buffers

Key Action
Space+, Switch buffer
Space+B+D Delete buffer
Space+B+O Delete other buffers
Shift+H Previous buffer
Shift+L Next buffer
[+B Previous buffer
]+B Next buffer

Windows

Key Action
Ctrl+H Go to left window
Ctrl+J Go to lower window
Ctrl+K Go to upper window
Ctrl+L Go to right window
Space+W+D Delete window
Space+W+- Split horizontal
Space+W+| Split vertical
Space+| Split vertical (alt)
Space+- Split horizontal (alt)

Window Resizing

Key Action
Ctrl+Up Increase height
Ctrl+Down Decrease height
Ctrl+Left Decrease width
Ctrl+Right Increase width
Key Action
Space+/ Grep (search in files)
Space+S+G Grep (search in files)
Space+S+W Search word under cursor
Space+S+B Search in buffer
Space+S+R Replace in files
++star++ Search word forward
++pound++ Search word backward
N Next search result
Shift+N Previous search result

Code Navigation (LSP)

Key Action
G+D Go to definition
G+R Go to references
G+I Go to implementation
G+Y Go to type definition
G+Shift+D Go to declaration
Shift+K Hover documentation
Space+C+A Code actions
Space+C+R Rename symbol
Space+C+F Format document
[+D Previous diagnostic
]+D Next diagnostic

Code Editing

Key Action
G+C+C Toggle line comment
G+C (visual) Toggle comment selection
Space+C+F Format buffer
Ctrl+Space Trigger completion
Enter Accept completion
Ctrl+N / Ctrl+P Navigate completion

Git

Key Action
Space+G+G LazyGit
Space+G+B Git blame
Space+G+D Diff this
Space+G+H Hunk actions
[+H Previous hunk
]+H Next hunk
Space+G+S Stage hunk
Space+G+R Reset hunk

Telescope (Fuzzy Finder)

Key Action
Space+Space Find files
Space+/ Grep
Space+: Command history
Space+F+F Find files
Space+F+R Recent files
Space+F+G Find git files
Space+S+S Search symbols
Space+S+H Help tags
Space+S+K Keymaps

Inside Telescope

Key Action
Ctrl+J / Ctrl+K Navigate results
Ctrl+N / Ctrl+P Navigate results (alt)
Enter Open file
Ctrl+X Open in horizontal split
Ctrl+V Open in vertical split
Ctrl+T Open in new tab
Esc / Ctrl+C Close

Neo-tree (File Explorer)

Key Action
Space+E Toggle explorer
Space+F+E Focus explorer
Enter / O Open file
A Add file/directory
D Delete
R Rename
Y Copy to clipboard
X Cut to clipboard
P Paste from clipboard
. Toggle hidden files
? Help

Terminal

Key Action
Space+F+T Terminal (root dir)
Space+F+Shift+T Terminal (cwd)
Ctrl+/ Toggle terminal
Ctrl+\ Toggle terminal (alt)

Inside Terminal

Key Action
Ctrl+\+\ Exit terminal mode
Esc+Esc Exit terminal mode

Diagnostics & Quickfix

Key Action
Space+X+X Trouble diagnostics
Space+X+Shift+X Trouble workspace diagnostics
Space+X+L Location list
Space+X+Q Quickfix list
[+Q Previous quickfix
]+Q Next quickfix

Motion & Editing

Text Objects

Key Action
iw / aw Inner/around word
ip / ap Inner/around paragraph
i" / a" Inner/around double quotes
i' / a' Inner/around single quotes
i( / a( Inner/around parentheses
i{ / a{ Inner/around braces
i[ / a[ Inner/around brackets
if / af Inner/around function
ic / ac Inner/around class

Surround (mini.surround)

Key Action
gza Add surrounding
gzd Delete surrounding
gzr Replace surrounding
gzf Find surrounding forward
gzF Find surrounding backward

UI Toggles

Key Action
Space+U+C Toggle colorcolumn
Space+U+F Toggle format on save
Space+U+H Toggle inlay hints
Space+U+L Toggle line numbers
Space+U+Shift+L Toggle relative numbers
Space+U+S Toggle spell check
Space+U+W Toggle word wrap
Space+U+Shift+C Toggle conceal

Folding

Key Action
Z+C Close fold
Z+O Open fold
Z+Shift+M Close all folds
Z+Shift+R Open all folds
Z+A Toggle fold

Marks & Jumps

Key Action
M + letter Set mark
++backtick++ + letter Jump to mark
Ctrl+O Jump back
Ctrl+I Jump forward
G+; Previous change
G+, Next change

Macros

Key Action
Q + letter Start recording macro
Q Stop recording
++at++ + letter Play macro
++at+at++ Repeat last macro

Discovering Keybindings

Press Space and wait for which-key to show available commands.

Search keybindings:

:Telescope keymaps

Or press Space+S+K.