h j k l | Left, Down, Up, Right |
w / W | Next word / WORD |
b / B | Previous word / WORD |
e / E | End of word / WORD |
0 | Start of line |
^ | First non-blank |
$ | End of line |
gg | Start of file |
G | End of file |
{number}G | Go to line number |
Ctrl+d / Ctrl+u | Half page down/up |
Ctrl+f / Ctrl+b | Full page down/up |
% | Jump to matching bracket |
/{pattern} | Search forward |
?{pattern} | Search backward |
n / N | Next / Previous match |
* | Search word under cursor |
# | Search word backward |
f{char} | Find char forward |
F{char} | Find char backward |
t{char} | Till char forward |
; / , | Repeat f/t forward/backward |
i / I | Insert at cursor / line start |
a / A | Append after cursor / line end |
o / O | Open line below / above |
s / S | Substitute char / line |
c{motion} | Change (delete + insert) |
C | Change to end of line |
Esc / Ctrl+[ | Exit insert mode |
x / X | Delete char / before cursor |
d{motion} | Delete with motion |
dd | Delete line |
D | Delete to end of line |
y{motion} | Yank (copy) |
yy / Y | Yank line |
p / P | Paste after / before |
"+y | Yank to system clipboard |
"+p | Paste from clipboard |
iw / aw | Inner / Around word |
i" / a" | Inner / Around quotes |
i( / a( | Inner / Around parens |
i{ / a{ | Inner / Around braces |
it / at | Inner / Around tag |
ip / ap | Inner / Around paragraph |
v | Character-wise visual |
V | Line-wise visual |
Ctrl+v | Block-wise visual |
gv | Reselect last selection |
o | Jump to other end |
> | Indent selection |
< | Outdent selection |
= | Auto-indent |
:w | Save file |
:q | Quit |
:wq or :x | Save and quit |
:q! | Quit without saving |
:e {file} | Edit file |
:sp {file} | Horizontal split |
:vsp {file} | Vertical split |
:%s/old/new/g | Replace all |
:%s/old/new/gc | Replace with confirm |
:noh | Clear search highlight |
:set number | Show line numbers |
:set relativenumber | Relative line numbers |
Ctrl+w s | Split horizontal |
Ctrl+w v | Split vertical |
Ctrl+w w | Switch windows |
Ctrl+w h/j/k/l | Navigate windows |
Ctrl+w q | Close window |
Ctrl+w o | Close other windows |
Ctrl+w = | Equal size windows |
Ctrl+w _ / | | Max height / width |
:tabnew {file} | New tab |
gt / gT | Next / Previous tab |
{n}gt | Go to tab n |
:tabclose | Close tab |
:ls or :buffers | List buffers |
:b {n} | Go to buffer n |
:bn / :bp | Next / Previous buffer |
:bd | Delete buffer |
:b# | Previous buffer |
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.clipboard = "unnamedplus" vim.keymap.set("n", "<leader>w", ":w<CR>")
vim.keymap.set("n", "<leader>q", ":q<CR>")
vim.keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-l>", "<C-w>l")
vim.keymap.set("i", "jk", "<Esc>") vim.g.mapleader = " " -- Space as leader local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", lazypath})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
"hrsh7th/nvim-cmp",
}) gd | Go to definition |
gD | Go to declaration |
gr | Go to references |
gi | Go to implementation |
K | Hover documentation |
<leader>rn | Rename symbol |
<leader>ca | Code action |
[d / ]d | Previous / Next diagnostic |