Vim editor configuration and use. And vim editor configuration
Vim configuration and simple usage.
Install sources for vim and tags use address: http://blog.csdn.net/shaohuazuo/article/details/46745209 blog
Vimrc configuration file can be referred to the following address: http://blog.csdn.net/shaohuazuo/article/details/41721647 blog
1. Enter the command line mode.
You can press esc to enter.
2. vim move cursor command. Switch to command line: (h left, j, k, right l)
H: move one character to the left, and l: move one character to the right. j: move one line down. k: move one line up.
3. From the edit mode to the insert mode, you can use, I, o, a and I, O, A (o, O, iI, aA)
Row where cursor is located
O: insert down, insert in the previous row
I: Insert at the current position. I: insert at the beginning of the current row
A: insert the cursor at the next position of the current character. A locates at the end of the row where the current cursor is located.
4. Delete.
Db, x: db deletes a word in the reverse direction, x deletes the cursor position character left behind, and deletes the word in the reverse direction.
B, dw: B: Return to the start of the word. dw: delete the word.
Daw: The cursor must be placed at the end of the deleted word. daw: All characters and spaces from the word to the previous one.
5. Select region vbo: the cursor is located at the end. This is a word that can be highlighted by vbo.
Veo: the cursor is placed in the word header. You can use veo to select words.
If you want to select multiple rows, you can use "v" and "jk" to select the upper and lower rows.
You can also select. ctrl + v in block mode,
6. We will combine the 3 and 5 parts to see the insert. mode.
1. Insert the word "This" to the number of rows in the selected row. In command line mode, use ctrl + v to block visualization mode and move up and down using jk. Select the corresponding row.
2. Press I. insert This, and then press esc OK.
3. insert at the end of each same row. ctrl + v enter the block selection mode, use jk to select rows up and down, and then press $. expand the selection area to the end of the row. after you press. insert at the end of the row. Press esc after the word is inserted.
7. Replace
: S/vivian/sky/Replace the first vivian in the current row with sky
: S/vivian/sky/g replace all vivian in the current row with sky
: N, $ s/vivian/sky/Replace the first vivian from row n to row n as sky
: N, $ s/vivian/sky/g replace all vivian values from row n to row n
: S #/# \ replace all/of the current row with this \. If/is replaced,/is not used as the separator.
8. c syntax error. 1. vim.
2. copen.
3. vsp a. c
4. make./
5. If there is a syntax error, you can delete it directly.
9. install vim + ctags. 1. sudo apt-get install vim.
2. sudo apt-get install ctags.
3. Configure the vim editor file as follows. Replace/etc/vim/vimrc with the file to be configured as follows.
4. Use the ctags-R command to generate the ctag file under the source code directory file to be viewed.
5. In the vimrc configuration file, set the path of the ctags file directory.
6. vim/etc/vim/vimrc
7. Add the following configuration, such as. set tag + =/home/zshh/work/arm/exynos4412_lzy1/src/linux/linux-3.5/tags.
8. The following is a simple application.
Vim-t memset // open a definition directly. There may be multiple definitions.
Vim a. c // switch to the command line.
Use the ta Command to find a definition.
Use the tselect command to view the definitions of this identifier in those files.
Author: Zuo Shaohua
Blog: http://blog.csdn.net/shaohuazuo/article/details/46959581
Reprinted please indicate the source.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.