l: Move left and right.
k: Move up and down.
<n>gg: First line, last line, nth line.
L: Top/Middle/Bottom of the screen.
zb: Position the screen with the cursor at the middle/top/bottom.
L: Position the cursor at the middle/top/bottom.
Ctrl-e: Scroll one line.
Ctrl-d: Scroll half-page.
Ctrl-f: Scroll full-page.
$: Beginning/End of line.
g_: First/Last character of line.
g;: Last edited position.
'.: Last edited line.
}: Previous/Next paragraph.
<N>|: Column N.
n%: Move to a file by percent of file.
W: Word-wise navigation.
#: Search for the word under the cursor forward/backward.
%: Find the match of a quote, parenthesis, bracket, or brace under the cursor.
I: Insert at the beginning of line.
A: Append to the end of line.
O: Open a new line after/before the current.
Ctrl-v: Visual mode (to select text!)
R: Replace text.
C: Change remaining part of line.
Enable italics in Vim
highlight Comment cterm=italicto
~/.vimrc(after the colorscheme declaration).
- If using jellybeans.vim colorscheme, make sure to add
let g:jellybeans_use_term_italics = 1too.
:ls: See a list of current buffers.
:e ../file.txt: Open ../file.txt.
:b file: Switch between all open files.
:b#: Open last visited file.
:tabs: List all tabs including their displayed windows.
:tabm 0: Move current tab to first.
:tabm: Move current tab to last.
:tabn: Go to next tab.
:tabp: Go to previous tab.
:tabfirst: Go to first tab.
:tablast: Go to last tab.
In normal mode:
gt: Go to next tab.
gT: Go to previous tab.
<i>gt: Go to tab in position
:sp: Horizontal split.
:10sp: 10 lines high horizontal split.
Ctrl-w _: Maximize a horizontal split.
Ctrl-w =: Equalize splits.
:res +5: Increase a split height by 5 lines.
:vs: Vertical split.
Ctrl-w |: Maximize a vertical split.
Ctrl-w =: Equalize splits.
:vertical resize +5/
:vert res +5: Increase a split height by 5 lines.
Ctrl-w c: Close a split.
Ctrl-w R: Swap splits.
:earlier 10m: Time travel in time to 10 minutes ago inside Vim.
:later 10m: Time travel in time to 10 minutes later inside Vim.
:norm Ibegin: Go to the beginning of a line and enter
begin, then repeat across all selected lines.
pwdterminal command from vim.
:read date: Insert the output of
datecommand in current line.
:30read date: Insert the output of
datecommand in line 30.
:$read date: Insert the output of
datecommand in the last line.
:10,15s/old/new/g: Substitute all occurences of
newfrom line 10 to 15.
:.,.+5s/old/new/g: Substitute all occurences of
newfrom the current line to the next 5 lines.
:g/import/d: Delete all lines including the word
:g!/import/d: Delete all lines not including the word
:g/^@/m$: Move all lines starting with
@to the end of the document.
:g/^$/d: Delete all blank lines in a document.
<CR>(aka carriage return/cartridge return) means
- Alternative to
Ctrl-[(recommended remappings for
:smile(doesn't work on Neovim)