How do I make Ctrl-A and Ctrl-X increment and decrement hexadecimal numbers?
:set nrformats+=hex
By adding hex to the nrformats option, you tell Vim to recognise hexadecimal literals such as 0xFF or 0xDEAD when or is pressed.
:set nrformats+=hex
By adding hex to the nrformats option, you tell Vim to recognise hexadecimal literals such as 0xFF or 0xDEAD when or is pressed.
:set diffopt+=algorithm:histogram
Switches Vim's diff algorithm from the default Myers algorithm to histogram, which produces more semantically meaningful diffs by avoiding false matches between
:set formatoptions-=cro
By default, Vim continues the current comment leader when you press in insert mode or open a new line with o/O.
:set formatoptions
The formatoptions setting is a string of single-character flags that governs Vim's automatic text formatting: when lines wrap, whether comment syntax continues
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
The map modifier turns a mapping's right-hand side into a Vimscript expression that is evaluated at the time the key is pressed, with its return value used as t
:set wildignore+=*.pyc,*.o,node_modules/**,.git/**
wildignore is a comma-separated list of glob patterns that Vim skips when expanding file names.
:set equalprg=gofmt
By default, Vim's = operator re-indents text using its internal rules.
config #config #editing #ex-commands #formatting #indentation
:set splitright splitbelow
By default, :split opens a new window above the current one and :vsplit opens to the left — the opposite of most modern IDEs and editors.
set sidescrolloff
set sidescrolloff={n} keeps at least n columns of context to the left and right of the cursor when long lines cause the view to scroll horizontally.
:set autochdir
The autochdir option tells Vim to automatically change the current working directory to the directory of the file in the active window whenever you switch buffe
:cnoremap %% <C-r>=expand('%:h').'/'<CR>
By mapping %% in command-line mode, you can type %% wherever you would normally type a path and have Vim automatically expand it to the directory of the current
:set keywordprg=:help
By default, pressing K in Normal mode runs the word under the cursor through an external program — usually man.
:setlocal {option}={value}
:setlocal sets an option only for the current buffer or window, leaving all other buffers and windows unaffected.
:set diffopt+=algorithm:patience,indent-heuristic
By default, Vim uses a basic longest-common-subsequence diff algorithm that can produce noisy, hard-to-read diffs.
zg and zw
When Vim's spell checker marks a word as incorrect but it is intentionally spelled that way (a name, abbreviation, or domain-specific term), you can permanently
# vim: set tabstop=2 shiftwidth=2 expandtab :
A modeline is a specially formatted comment that Vim reads when it opens a file and applies as local settings — no plugin or project-level vimrc required.
:augroup
Wrapping autocmds in a named augroup with autocmd! at the start prevents duplicate autocommands from accumulating every time your vimrc is sourced.
:iabbrev
:iabbrev defines insert mode abbreviations — short strings that expand automatically when you type a non-keyword character (like space or Enter) after them.
:set nrformats-=octal
Vim's and increment and decrement numbers under the cursor.
set wildcharm=<Tab>
By default, pressing in a : mapping inserts a literal tab character rather than triggering wildmenu completion.