Vim Quick Reference (2)
2018-01-30 14:56
363 查看
* 下面的操作都是在Linux环境下运行的 *
1. To navigate in the document to prepare to edit here are a few of the choice available:
a. Go to the first line: 1G
b. Go to the first line: H
c. Go to the last line: L
d. Move the cursor down one line: j
e.Move the cursor up one line: k
f. Move the cursor right one character: l (lower case L)
g. Move the cursor left one character: h
h. Go to the beginning of a line: 0 (a zero)
i. Go to the first non-black character: ^
j. Go to the end of the line: $
k. Go forward one full screen: control f
l. Go backwards one full screen: control b
m. Go forward half a screen: control d
n. Go backwards half a screen: control u
2. Other command mode options are:
a. Undo the last change: u
b. To delete an entire line: dd
c. To copy the current line: yy or Y
d. To paste the copied line(s): p
3. To enter insert mode; once insert mode has been entered, you can type normally inserting text. When done, you will need to exit insert mode with the escape key or by holding down the control key and pressing c at the same time:
a. Insert before the cursor: i
b. Append after the cursor: a
c. Insert at the beginning of a line: I
d. Append at the end of the line: A
4. To end insert mode, press escape key or control C
5. Options for saving your work and quitting:
a. To save your work :w
b. To save changes and exit (quit) :wq
c. To quit without saving :q! all changes will be lost !
6. Navigation options at last line mode include:
a. Go to a particular line :42 go to line #42
b. Find some text in the file /text
c. Find the next occurrence /
d. Search and replace :%s /to_replace/replace_with/
flags: g //replace all
i //case insensitive
c //confirm before doing each replacement
7. To enter Visual mode: v
8. Once in Visual mode, we can cut, copy and paste:
a. To delete text and copy it to the clipboard: d
b. To copy (yank) text: y
c. To paste text that has been copied: p
9. Or we can alter indentation:
a. To add indentation to the right: >
b. To reduce indentation (move to the left): <
10. To end visual mode, press: escape key or control C
11. Split Screen: One of really great features is working in split screen mode; this allows you to view multiple files simultaneously
a. Split horizontally: vim -o file1.cpp file2.cpp
b. Split vertically: vim -O file1.cpp file2.cpp
c. Split all of your .cpp files: vim -O *.cpp
d. Switch between screens: cntrl ww
12. Other Commands for multiple files
a. Open a file next to the current code, vertically :vs filename.extension
b. Open a file below the current code, horizontally :sp filename
c. Save and close all open files :wqa
d. Open a file in a new buffer :e filename.extension
e. Cycle through available files tab
1. To navigate in the document to prepare to edit here are a few of the choice available:
a. Go to the first line: 1G
b. Go to the first line: H
c. Go to the last line: L
d. Move the cursor down one line: j
e.Move the cursor up one line: k
f. Move the cursor right one character: l (lower case L)
g. Move the cursor left one character: h
h. Go to the beginning of a line: 0 (a zero)
i. Go to the first non-black character: ^
j. Go to the end of the line: $
k. Go forward one full screen: control f
l. Go backwards one full screen: control b
m. Go forward half a screen: control d
n. Go backwards half a screen: control u
2. Other command mode options are:
a. Undo the last change: u
b. To delete an entire line: dd
c. To copy the current line: yy or Y
d. To paste the copied line(s): p
3. To enter insert mode; once insert mode has been entered, you can type normally inserting text. When done, you will need to exit insert mode with the escape key or by holding down the control key and pressing c at the same time:
a. Insert before the cursor: i
b. Append after the cursor: a
c. Insert at the beginning of a line: I
d. Append at the end of the line: A
4. To end insert mode, press escape key or control C
5. Options for saving your work and quitting:
a. To save your work :w
b. To save changes and exit (quit) :wq
c. To quit without saving :q! all changes will be lost !
6. Navigation options at last line mode include:
a. Go to a particular line :42 go to line #42
b. Find some text in the file /text
c. Find the next occurrence /
d. Search and replace :%s /to_replace/replace_with/
flags: g //replace all
i //case insensitive
c //confirm before doing each replacement
7. To enter Visual mode: v
8. Once in Visual mode, we can cut, copy and paste:
a. To delete text and copy it to the clipboard: d
b. To copy (yank) text: y
c. To paste text that has been copied: p
9. Or we can alter indentation:
a. To add indentation to the right: >
b. To reduce indentation (move to the left): <
10. To end visual mode, press: escape key or control C
11. Split Screen: One of really great features is working in split screen mode; this allows you to view multiple files simultaneously
a. Split horizontally: vim -o file1.cpp file2.cpp
b. Split vertically: vim -O file1.cpp file2.cpp
c. Split all of your .cpp files: vim -O *.cpp
d. Switch between screens: cntrl ww
12. Other Commands for multiple files
a. Open a file next to the current code, vertically :vs filename.extension
b. Open a file below the current code, horizontally :sp filename
c. Save and close all open files :wqa
d. Open a file in a new buffer :e filename.extension
e. Cycle through available files tab
相关文章推荐
- VIM Quick Reference Card
- Linux下编程工具的使用(6) - VIM编辑器系列(2) - Vi Quick Reference
- VIM Quick Reference Card
- Quick Reference to Patch Numbers for Database PSU, SPU(CPU), Bundle Patches and Patchsets (Doc ID 14
- svn 指令整理 附 ->Svn Quick Reference Card<- pdf
- vim quickfix 插件定位出错
- Ruby in a nutshell: a desktop quick reference
- Bash+Quick+Reference 笔记4
- Latex公式编辑,适用于MarkDown编辑器 mathjax-basic-tutorial-and-quick-reference
- Quick reference for Fedora Core 13's installation on VMware 6.5
- DNN - skin quick reference
- MongoDB - The mongo Shell, mongo Shell Quick Reference
- SSAS Quick Reference: Attribute Key Cannot Be Found
- Git quick reference for beginners
- Bash+Quick+Reference 笔记2
- Emacs Quick Reference
- quick reference for sed and awk
- SQL Server 2005 DBCC Command Quick Reference
- DNN - skin quick reference
- Windows Vista For Dummies Quick Reference