enter different modes:
- i :insert
- v: visual
- shift+v :visual line
- control+v :visual block
quit different modes:
- esc : quit insert
- v :quit visual
- shift+v :quit visual line
- control+v :quit visual block
quit & save
- :q :quit
- :x :quit and save
- :q! :force quit without saving
undo & redo
- u :undo
- control + r :redo after too much undo:
move the cursor
- h :left
- j :down
- k :up
- l :right
- fX :pressing f and X together moves cursor to next 'X' in the same line (X is any character)
- ; :repeat fX in same direction
search
- :/text :search text
- n :next matching
- N :previous matching
- ggn :jump to the first matching
- GN :jump to the last matching
- :/<text> : search your exact text
- :^text :search text at beginning of one line
write lines to file/clipboard
- :1,2w filename :write line 1-2 to a file
- set clipboard=unnamed :add to .vimrc to share the Mac clipboard with vim
- :1,2w !pbcopy : copy line 1-2
- :r !pbpaste :paste the clipboard
网友评论