You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ctrl + a Goto BEGINNING of command line
ctrl + e Goto END of command line
ctrl + b move back one character
ctrl + f move forward one character
alt + f move cursor FORWARD one word
alt + b move cursor BACK one word
Other
ctrl + l Clear the screen (same as clear command)
ctrl + u Clear all BEFORE cursor
ctrl + k Clear all AFTER cursor
ctrl + r Search PREVIOUS commands
ctrl + c kill whatever is running
ctrl + d Exit shell (same as exit command)
ctrl + w delete the word BEFORE the cursor
ctrl + t swap the last two characters before the cursor
ctrl + y paste (if you used a previous command to delete)
ctrl + z Place current process in background
ctrl + _ undo
esc + t Swap last two words before the cursor
esc + . OR esc + _
alt + [Backspace] delete PREVIOUS word
alt + <
alt + >
alt + ?
alt + *
alt + . print the LAST ARGUMENT (ie "vim file1.txt file2.txt" will yield "file2.txt")
alt + c
alt + d
alt + l
alt + n
alt + p
alt + r
alt + t
alt + u
~[TAB][TAB] List all users
$[TAB][TAB] List all system variables
@[TAB][TAB] List all entries in your /etc/hosts file
[TAB] Autocomplete
!! Run PREVIOUS command (ie "sudo !!")
!vi Run PREVIOUS command that BEGINS with vi
cd - change to PREVIOUS working directory
Ctrl + b is default to enter before you enter the commands
M = Left Alt key
Windows
c Create a new window.
& Kill the current window.
n Change to the next window.
p Change to the previous window.
, Rename the current window.
l Move to the previously selected window.
w Choose the current window interactively.
M-n Move to the next window with a bell or activity marker.
M-p Move to the previous window with a bell or activity marker.
Panes
" Split the current pane into two, top and bottom.
% Split the current pane into two, left and right.
x Kill the current pane.
; Move to the previously active pane.
o Select the next pane in the current window.
! Break the current pane out of the window.
q Briefly display pane indexes.
Other
d Detach the current client.
$ Rename the current session.
[ Enter copy mode to copy text or view the history.
f Prompt to search for text in open windows.
r Force redraw of the attached client.
L Switch the attached client back to the last session.
Copy Mode
C-b { Enter Copy Mode (While in copy mode you don't need to press C-b)
space Start Selection
enter End Selection (Takes you out of copy mode)
C-b } Paste Copied Text
vim + file.ext Open file at last line
vim +42 file.ext Open file at line 42
vim +/^include_path Open the file at the line that starts with include_path
Exiting
:q Quit
:wq Write and Quit
:q! Quit without saving
ZZ Write and quit
ZQ Quit without saving
Moving
h Move cursor LEFT
j Move cursor DOWN
k Move cursor UP
l Move cursor RIGHT
gg Move to START of buffer
G Move to END of buffer
ngg OR nG Move to n line (n represents a digit)
Working with Multiple Files
e filename Edit a file in a new buffer
bnext (or bn) Go to next buffer
bprev (of bp) Go to previous buffer
bd Delete a buffer (close a file)
sp filename Open a file in a new buffer and split window
vsp filename Open a file in a new buffer and vertical split window
ctrl+ws Split windows
ctrl+ww Switch between windows
ctrl+wq Quit a window
ctrl+wv Split windows vertically
Inserting Text
a append after the cursor
A append at end of line
i Insert before cursor
I Insert before line
o Create new line below and start editing
O Create new line above and start editing
gi Place cursor where you were last editing (Useful for when you exit Insert mode and then need to go back where you once were)
Other Commands
u undo
ctrl + R redo
One liners
w|bd write (save) buffer and then close the buffer
Spell Checking
" ~/.vimrc
" Enable spell checking
set spell
Commands
]s Move to next misspelled word
[s Move to previous misspelled word
z= Show list of possible replacements words
Code Folding
zo OPEN code fold under cursor
zc CLOSE code fold under cursor
zR OPEN ALL code folds
zM CLOSE ALL code folds
is this all vim related?