Vim environment setting and recording

Source: Internet
Author: User

It is found that if we use the VIM software to search for a string inside a file, the string will be anti-white, and the next time we again with vim to edit the file, the search string anti-white situation still exists! Even when editing other files, if the string exists in other files, wow! Unexpectedly or actively anti-Baiya! It's amazing! In addition, when we repeatedly edit the same file, when the second time to enter the file, the cursor unexpectedly in the last line to leave the top of it! It's so convenient ah ~ But, how can this be?

This is because our VIM will take the initiative you have done the behavior of the log down, so that you can easily work next time Ah! The file that recorded the action is: ~/.viminfo! If you've ever used vim, your home directory should have this file. This file is automatically generated and you do not have to build it yourself. And what you've done in vim, you can find it inside this file ^_^

In addition, each distributions is not the same as the preset environment for VIM, for example, some versions do not have a high brightness when searching for keywords, some versions will actively help you to indent the behavior. But these can be self-setting, that is, the environment setting of the VIM ~vim environment setting parameters are many, if you want to know the current setting, you can enter in the general mode ": Set all" to check, but ... Set up the project is too many ~ so, brother Bird here is only a few commonly used to list some simple set values, provide you with reference AH.

Tips:
The so-called indentation, that is, when you press Enter to edit a new line, the cursor will not be at the beginning of the line, but in the previous row of the first non-whitespace alignment!

In short, these settings are very useful! But...... Do I have to reset each parameter value every time I use vim? That's not reasonable, is it? Oh, yes!

So, we can use the configuration file to directly specify the VIM operating environment we are accustomed to! The overall Vim setting value is generally placed in/ETC/VIMRC this file, however, it is not recommended that you modify him! You can modify ~/.VIMRC this file (default does not exist, please manually build it yourself!) ), write the set value you want!

For example, this can be a file:

Vim ~/.VIMRC"This file's double quotation mark (") is the annotation set hlsearch            "high brightness anti-white set backspace=2         " can be deleted at any time with backspace key set autoindent          "Auto indent set Ruler               "can display the status of the last row set Showmode            " The state of the row in the lower left corner set nu                  "You can display the line number at the top of each line! Set Bg=dark             "show different undertone tones syntax               on" for grammar checking, color display. 

In this file, use "Set Hlsearch" or ": Set Hlsearch", that is, the front has no colon ":" The effect is the same! As for double quotation marks, it is an annotation symbol! Do not use the wrong notation, or a warning message will occur every time you use VIM! After setting up this file, when you re-use VIM to edit a file, the default setting of the file is written on the top of it, so, is it convenient for your operation Ah! Use Vim's environment to set the function! ^_^

Using Vim to write a python program, everyone needs to be able to auto-complete, change the configuration file can also be implemented, add the following statements:

FileType plugin Onlet g:pydiction_location = ' ~/.vim/tools/pydiction/complete-dict '

Save exit after the modification is complete, then restart Ubuntu

Vim environment setting and recording

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.