Skip to content

carbonatezero/vim.baby.knowledge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

vim and Linux: the cheat sheet

Daily used commands of vim

Compressing

tar -czvf archive.tar.gz my_directory

Existing

:q :q! :w :wq

Cursor movement

Command Description
h j k l Arrow keys
Ctrl+f/b Forward/backward
Ctrl+d/u Move down/up half page
G Go to the bottom of the page
gg Go to the top of the page
{ / } Forward/Backward one paragraph
Ctrl+e/y Scroll down/up one line
0 Start of line
^ Start of line after white space
$ End of line
% Jump between matching () or {}

Editting

u : Undo
ctrl+r : Redo
i/a : Start insert mode at/after cursor
I/A : Start insert mode at the beginning/end of the line

Visual mode (slecting text)

v
V
ctrl+v

Clipboard

y : copy the selcted characters in the visual mode
p : paste after cursor

Deletion

d x

Search/Replace

:%s/<old>/<new>/g : replace all with throughout file
:%s/<old>/<new>/gc : replace all with throughout file with confirmation

/<text> search for
?<text> search for backward

To comment out blocks in vim:

  • press Esc (to leave editing or other mode)
  • hit ctrl+v (visual block mode)
  • use the j/k "arrow keys" to select lines you want (it won't highlight everything - it's OK!)
  • Shift+i (capital I)
  • insert the text you want, e.g. %
  • press EscEsc

No need to go beyond the commands above.

About

Daily used commands of vim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published