笔者:YY同学
使用 vim 打开文件
vim filename
模式介绍
vim 一般有 2 种模式,Insert 模式和 View 模式。
- Insert 模式和传统的记事本差不多,以下是该模式下按键命令:
Command | Functionality |
---|---|
Esc | Shift to View Mode |
↑ | Come to previous row |
↓ | Come to next row |
← | Come to previous character |
→ | Come to next character |
Key | Type the alphabet |
- View 模式是预览模式,以下是该模式下按键命令:
Command | Functionality |
---|---|
i | Shift to Insert Mode |
gg | Back to the Top of File |
G / Shift + g | Navigate to the End of File |
b | Back to the Head of Previous Word |
w | Go to the Head of Next Word |
e | Go to the Tail of Next Word |
yy | Yank ( Copy the Whole Line ) |
p | Paste the Whole Line |
x | Delete One Character |
dd | Delete the Whole Line |
u | Undo Previous Modification |
Ctrl + r | Redo Previous Modification |
k / ↑ | Cursor Go Upward |
j / ↓ | Cursor Go Downward |
h / ← | Cursor Go Back |
l / → | Cursor Go Forward |
: | Start to Enter Instruction |
:q | Quit Vim |
:q! | Quit Without Save |
:w | Save |
:wq | Save & Quit |
:set nu | Reveal Line Number |
:set ff? | Show File Format |
:set ff=unix | Change File Format to Unix |