My VIM configuration record

Source: Internet
Author: User
Tags documentation

A General introduction

Configure the path,/ETC/VIM/VIMRC, this is the vim configuration of the system, assuming that a PC is used by multiple users, each user's habits are different and can use different configurations. Create a new. vimrc file under the user folder.

I am now writing the configuration in the configuration of the system, my configuration file as seen below:

Set Nuset tabstop=4set autoindentset matchtime=1set hlsearchset cindentset shiftwidth=4set rulerset showmodecolorscheme Desertset guifont=droid\ sans\ mono\ 14


The above is the main configuration. Written in the system configuration, in the individual user, made some interesting customizations, the current User folder under the VIMRC configuration file such as the following:

Bundle ' vim-scripts/a.vim ' filetype plugin indent on     "required!

Two detailed introduction

The following are the records that are made according to the process used. Constantly intact its vim configuration

1. The font settings under different platforms are not the same, for general purpose, this can be set, see (Http://stackoverflow.com/questions/3539437/gvim-ubuntu-letter-spacing-consolas-font):

The If has ("GUI_GTK2")    set guifont=consolas\ 11elseif have ("Gui_macvim")    set Guifont=consolas:h12elseif has ("Gui_ Win32 ")    set Guifont=consolas:h11end

2. Use Vundle to manage Vim's plugins: Click to open the link:

(1) Download Vundle

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
(2) Add configuration script in VIMRC:

Set nocompatible               "be improvedlet g:ycm_global_ycm_extra_conf = '/home/zy/.vim/bundle/youcompleteme/third_party/ ycmd/examples/.ycm_extra_conf.py ' filetype off                   ' required! set Rtp+=~/.vim/bundle/vundle/call VUNDLE#RC () "Let Vundle Manage Vundle "required! Bundle ' Gmarik/vundle ' bundle ' Vim-scripts/fcitx.vim ' "Convenient XML plug-in bundle ' Othree/xml.vim '   " self-reinforcing plugin bundle " Valloric/youcompleteme ' "folder tree bundle ' Scrooloose/nerdtree '  filetype plugin indent on     " required!
Among them, Othree/xml.vim, refers to GitHub on the user for Othree write Xml.vim plug-in, assuming that the resources of other places, write all the URL can be.

(3) Install the corresponding plug-in, run under Terminal:

Vim +bundleinstall +qall

(4) List of my plugins:

A. Xml.vim writes the XML plug-in. For detailed usage, refer to the documentation inside DOC;

B. Youcompleteme complement the plug-in, is said to be the best use of complete plug-ins, need to compile, detailed methods to see: Click to open the link. I encountered a problem when compiling: Could not find Pythonlibs, method: sudo apt-get install Python-dev. There are also errors, which are insufficient compilation memory. Once again, it can be installed. There are C + + header files and STL system functions can not be self-completion of the problem, is not well-written in the configuration file, open the configuration file:/home/zy/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/. ycm_extra_conf.py, using the command:

echo | Clang-v-e-x C + +-
To find the appropriate header file for C + +, then the output will be added to the above configuration file.

Detailed details on GitHub have been said, it is necessary to explain that the assumption can not complete the STL, another compilation test. It is easy to use the method of quick installation.

C. nerdtree file Folder tree. Bundle ' Scrooloose/nerdtree ', set up a reference post: Click the Open link to set the appropriate shortcut key in VIMRC: Map <F2>: Nerdtreetoggle<cr> Ctrl+w is able to switch forms. Suppose you open gvim under Terminal, and then open the folder to show the current root folder, and in the file browser right click on the Gvim Open is the user root folder. Detailed commands to view Help documents

D.tagbar the plug-in that browses the code symbol, the object-oriented aspect is better than Taglist,tagbar. So I chose the tagbar. The same way to install Tagvar,github address: Click the Open link. This plugin is based on ctags, so you need to install Ctags (sudo apt-get install ctags) first. Then do for example the following configuration:

"Tagbar settingnnoremap <silent> <F4>: Tagbartoggle<cr>let g:tagbar_ctags_bin= '/usr/bin/ctags ' let G:tagbar_width=30

Use the F4 key to toggle the display of the Tagbar

F. Batch gaze and anti-gaze. Simpler than the plugin, see blog Click to open the link. Select the row you want to stare at and CTRL + V into column mode. Press "I", enter the insertion mode, enter the appropriate gaze, and note press ESC two times. Bulk cancellation of gaze, the same is the scenario. Of course there is this plugin, just not all dependent plugins.

High-speed switching between the G.c file and the. h file. A.vim plugin, github address: Click to open the link. Enter ": A" on the command line to enable high-speed switching. Because it's simpler, there's no need to set up shortcut keys. Please refer to the Help documentation for more specific references.


3. Vim to open the file in Windows under the text garbled solution:
"To solve the problem of Chinese garbled, first check the code, converted into Utf-8set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936set Termencoding=utf-8set Encoding=utf-8


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

Tips for use:

1. Format code:

Formatted full text: gg=g format current navigation: = =

2. Fill vim with a Chinese help document. Reference post: Click to open link

(1) Download the installation package: Click the Open link

(2) Unzip and install:

sudo./vimcdoc.sh-i
(3) Configure, add a sentence in the ~/.VIMRC:

Set HELPLANG=CN
(4) Use in VIM:

: Help usr
will be able to use the Chinese Vim help document. Thank you for translating this group of people.

3. Center on input

Requirements: Sometimes you always want to enter in the middle of the screen. You can enter ZZ directly in the command-line mode. See blog: Click to open a link

Not to be continued, ...

My VIM configuration record

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.