The configuration and use of the Vim editor.

Source: Internet
Author: User

Vim configuration and easy-to-use methods.

Install vim and tags using the source link address: http://blog.csdn.net/shaohuazuo/article/details/46745209 blog

VIMRC configuration file can refer to the following address: http://blog.csdn.net/shaohuazuo/article/details/41721647 blog


1. Enter command-line mode.

You can press the ESC key. You can enter.
2. Vim moves the cursor command. Switch to the command line:(H left, j down, Upper K, right L)
H: Move one character to the left, L: one character to the right. J: Move down one line. K: Move up one line.
3. From edit mode to insert mode. Can be used, i,o,a and I,o,a(O,O,II,AA)
Cursor is in the row
O: Next insert, O previous line insert
I: The current position is inserted. I: When the beginning of a period line is inserted
A: The cursor is inserted at the next position of the current character, and a is positioned at the end of the line where the current cursor is located
4. Delete.DB,X:DB reverse Deletes a word, X deletes the left cursor position character. Reverse Delete.
B,dw:b: Back to the beginning of the word. DW: Delete this word.
Daw:daw: The cursor needs to rest at the end of the deleted word. Daw: Delete all characters and spaces to the previous word in this word.
5. Select a regionVBO: The cursor position is at the tail. This is a word that can be vbo to highlight a selection.
VEO: The cursor position is at the head of the word. You can use Veo to select a word.

If you need multiple lines to select the words can be V, in the use of JK, the top and bottom selection line.
You can also select. Ctrl + V with block mode,
6. We combine 3, 5 parts together to see the insert. Mode.1. Insert a word in the row number of the selected line this can be done in command-line mode using CTRL + V, into block visual mode, using JK to move up and down. Select the appropriate line.
2. Press I to insert this, then press ESC several OK.
3. Insert at the end of each line, you can use. Ctrl + V to enter block selection mode, use JK up and down to select a good line, then press $. Then expand the selection to the end of the line. After pressing A. Insert at the end of a row, insert the word and press ESC to OK.
7. Replace: s/vivian/sky/replaces the current line the first Vivian is sky
: S/vivian/sky/g replaces the current line all Vivian are sky
: N, $s/vivian/sky/replaces the first Vivian of each row in the nth row to the last row is sky
: N, $s/vivian/sky/g replace the nth line to the last row all Vivian are sky
: s#/#\ all/replace the current line with this \. If the replacement is/all is not used/as the separator symbol.
8. Find the C syntax error.1. Vim.
2. Copen.
3. VSP A.C
4. Make./A
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 and replace the/ETC/VIM/VIMRC with the file that needs to be configured. 4. Use the Ctags-r command to generate the Ctag file under the source code directory file you want to view.
5. Set the path to the Ctags file directory in the VIMRC configuration file.
6.vim/etc/vim/vimrc
7. Add the following as follows. The set Tag+=/home/zshh/work/arm/exynos4412_lzy1/src/linux/linux-3.5/tags configuration is complete.
8. The following is a simple use.
Vim-t memset//Open the definition of a representation directly. There may be more than one.
Vim A.C//switch to the command line.
Use the TA command to find a definition.

Use the Tselect command to view the identifiers in those files that are defined.

Author: Zoo Shaohua

Blog Address: http://blog.csdn.net/shaohuazuo/article/details/46959581

Reprint please indicate the source.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.