Vim (Linux editor) simple configuration and common commands

Source: Internet
Author: User

A simple configuration

1 Add configuration file. vimrc

Under directory/etc/, there is a file named VIMRC, which is a public vim configuration file in the system and is valid for all users. and in each user

Home directory, you can create a private configuration file named: ". VIMRC".

The following is an example of an ordinary user:

set up in the user's home directory . vimrc file

or directly download the master to write a good move to their home directory can be

Download Vimrc.zip, unzip the file as. VIMRC, put it in the current user's directory.

Links: Http://files.cnblogs.com/ma6174/vimrc.zip

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/EA/wKioL1dEcDTyKqJtAAAMYpOqiTQ176.png "title=" Picture 1.png "alt=" Wkiol1decdtykqjtaaamypoqitq176.png "/>650) this.width=650; src=" http://s3.51cto.com/wyfs02/M01/ 80/eb/wkiom1deb1lhum_6aabuyb_-4xw432.png "title=" image 2.png "alt=" Wkiom1deb1lhum_6aabuyb_-4xw432.png "/>

Open . VIMRC

Some settings are commented out to cancel the corresponding comments only need to delete the previous "number

. Set line number, lexical highlighting, auto indent, etc.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/EB/wKiom1dEb4eSBfMlAABQpwo37s0468.png "title=" Picture 3.png "alt=" Wkiom1deb4esbfmlaabqpwo37s0468.png "/>


2 . Installing the TagList plugin

Links: http://www.vim.org/scripts/script.php?script_id=273

Download the Taglist_xx.zip, put the extracted doc content to ~/.vim/doc, the extracted plugin under the contents of the copy to

~/.vim/plugin


650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/80/EA/wKioL1dEcJ6DTIALAABXc3TKb3U568.png "title=" Picture 4.png "alt=" Wkiol1decj6dtialaabxc3tkb3u568.png "/>

3 Installation Manager Winmanager Plug-in

Links: http://www.vim.org/scripts/script.php?script_id=95

Download Winmanager.zip, version 2.X or above.

Put the extracted doc content into ~/.vim/doc, and copy the extracted content from the plugin to the ~/.vim/plugin

4 Add the following sentence to the ~/.VIMRC

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/EB/wKiom1dEb83ih2TGAAATc8n64vs776.png "style=" float: none; "title=" Image 5.png "alt=" Wkiom1deb83ih2tgaaatc8n64vs776.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/EA/wKioL1dEcMDjPauaAAAhuXL5Rr4768.png "style=" float: none; "title=" Image 6.png "alt=" Wkiol1decmdjpauaaaahuxl5rr4768.png "/>

Note: WM with: a space in the middle

5. Restart vim, open xxx.cpp or XXX.C, enter "WM" in normal state, you will see the following interface.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/EA/wKioL1dEcN-h6aoGAAEXVfStSEA351.png "title=" Picture 7.png "alt=" Wkiol1decn-h6aogaaexvfstsea351.png "/>

more specific: http://blog.csdn.net/wooin/article/details/1858917

------------------------------------------------------------------------------------------

Two common commands

Three different modes

Bottom row mode

Command mode

Insert mode

Undo Esc +u

shift+:w Save

shift+:q exit

GG Jump file First

Shift+gg = = GG file End

8+shift+g jump to line 8

:8 position to line eighth

yy Copy

3yy copy 3 rows

P Paste to next line

DD Delete +p== clip

3DD Delete 3 rows

U Cancel

shift+4==$ end of line

shift+6==^ beginning

shift+~ Convert the current letter case

X Delete current letter backward Delete

Shift+x Current cursor forward delete

5+shift+x Delete 5 before cursor (currently unchanged)

5+x Backward Delete of 5

W Turn backward in Word (word head)

e (end of Word)

b Flip forward in words

HJKL up or down

I Insert

A next character insert

o empty line then insert

/+ string (backward) lookup

? + String Forward Lookup

2+l Jump two columns

y+w Sticky words

r+ letters replaced with letters

Shift+r Overall Replacement

C+w Word Delete mode transform to insert mode

: Setnu sets line number

: Set Nonu cancel line number

:q! Force Exit

: vs test1.c split screen

The cursor is cut to the right Ctrl + W + L

Left ctrl+w+h


This article is from the "City Hunter" blog, please be sure to keep this source http://alick.blog.51cto.com/10786574/1782770

Vim (Linux editor) simple configuration and common commands

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.