Vim configuration of the primary road---to create their own vim

Source: Internet
Author: User
Tags sorted by name git clone


1, Vim is the ancient artifact of Linux programmer programming

Vim is the most famous text/code Editor on the Linux system, and it is also an enhanced version of the VI editor of the early years, known as the best classic ancient artifact in the text/code Editor. The reason why it is such a reputation, I think mainly for the following reasons: 1. It is ancient and mysterious, the learning curve is steep, difficult to control, but once learned to benefit. is now regarded as a master, geek dedicated editor. So although Vim is already an antique-grade software, there are countless new people who are struggling to learn to use it. 2. Lightweight, needless to say, when only a text file (such as script code, configuration file) Simple editing, the use of the tool is of course the lighter the better. Vim is also a powerful tool for reading text files. 3. Classic clever editing methods and powerful features. It all the way to use the keyboard operation, the user must remember a bunch of shortcut keys, key combinations and a variety of commands to get started, once the use of proficiency in editing efficiency far beyond the rest of the editor, and with a variety of plug-ins, syntax highlighting, code completion, color scheme and other extremely rich resources and flexible configuration;


2, vim into also plug-ins, lost also plug-ins

Some people say, Vim is "into also plug-ins, loser also plug-ins." Vim's flexible configuration and rich plugins greatly enhance its functionality, but it also greatly increases our difficulty in managing vim. First, before using VIM, it must be properly configured, and the configuration of vim is extremely cumbersome. So there are many articles on the internet, such as "Universal Configuration" and "strongest configuration", which can be consulted. However, some of these articles have many errors, even the content of repetition, conflict, and these articles are "to give people to fish, rather than grant people to fishing", the configuration they gave can be copied, but often make people unclear so. Vim is rich in plug-ins, there is no lack of the use of a variety of plug-ins to configure VIM as a powerful IDE, but Vim's plug-in management is very difficult, because each installation of a plug-in, it is necessary to put the plug-in files into the VIM installation path plugin, AutoLoad, Syntax, doc and other directories. Fortunately, Vundle turned out, it not only solves the problem of the Vim plug-in in the file system, while being able to automatically search and download plugins.


3. Two files on vim

1. Viminfo

In Vim, Vim is automatically recorded and saved in the ~/.viminfo file. This is to facilitate the next processing, such as: Vim when you open the file, the cursor will automatically appear in the last location. The original searched string, the newly opened file is automatically highlighted.
the ~/.viminfo file is automatically generated by the system .

2. VIMRC

The VIMRC file is a VIM environment settings file. The overall vim setting is in the/ETC/VIMRC file. Modifying the/ETC/VIMRC file is not recommended, and each user can set up vim in the user's root directory and create a new ~/.VIMRC. Vim has more configuration options,

: Set All

You can view all the configuration items.
Common configuration:

: Set Nu:set Nonu whether the line number is displayed: Set Wrap:set nowrap Whether the line is wrapped: set Hlsearch:set nohlsearch Whether the search is highlighted: Set Autoindent:set noautoindent Auto indent: Whether set backup automatically backs up the modified files, defaults to No, if set Bakcup, the filename~ backup file is automatically generated when modified. : Set ruler Displays the lower-right status bar: Set Showmode displays the lower-left status bar,--insert--and the like: set displays values that differ from the system defaults: syntax on:syntax off program syntax switch: Set Bg=dark:set bg= Light Display Color tint


4, install the plug-in management---vundle

Vundle on GitHub: Https://github.com/VundleVim/Vundle.vim

If the installation of this page is all, because it is English version of the Chinese as a patriotic I, is tearful to understand, this is what ghosts, dear readers ~, trouble everyone to find Baidu Pro mom, its Baidu translation or wide to drip ~


This is my own. vimrc file, although it's simple, but it's definitely available.

The first half is from the great God on GitHub.

The latter part is to learn and summarize

Have any command that doesn't understand the set behind

Eg:set Scrolloff can be used

: Help command name to see what the hell

In front of the "is the annotation function oh like C language//

"Turn off Vim compatibility mode to turn off VIM all expansion function set nocompatible               "Close File type filetype off                   "  Add Vundle path to Vim's path to Set rtp+=~/.vim/bundle/vundle.vim" Perform vundle initialization call vundle#begin () "  Let Vundle manage vundle this plugin plugin  ' Vundlevim/vundle.vim ' plugin  ' Tpope/vim-fugitive ' "plugin from http://vim-scripts.org/vim/scripts.htmlplugin  ' L9 '" plugin  ' Taglist.vim ' plugin  ' taglist.vim ' "plugin from  ' thenerdtree ' plugin  ' nerdtree '" Plugin  ' Vim-airline-themes ' plugin  ' vim-airline/vim-airline-themes ' "plugin  ' Valloric/youcompleteme ' Plugin   ' valloric/youcompleteme '  Git plugin not hosted on GitHubPlugin  ' Git ://git.wincent.com/command-t.git ' " git repos on your local machine  (i.e.  when working on  your own plugin) "plugin  ' File:///home/gmarik/path/to/plugin '"  the sparkup vim  script is in a subdirectory of this repo called vim. "  pass the path to set the runtimepath properly. plugin  ' Rstacruz/sparkup ',  {' RTP ':  ' vim/'} " install l9 and avoid a  naming conflict if you ' Ve already installed a '  different version  somewhere else. " plugin  ' ascenator/l9 ',  {' name ':  ' newL9 '} " all of your plugins must  be added before the following linecall vundle#end ()               " To ignore plugin indent  changes, instead use:filetype plugin indent on     " Brief  help " :P luginlist &Nbsp;     - lists configured plugins " :P lugininstall     - installs plugins; append  '! '  to update or just '  : Pluginupdate " :P luginsearch foo - searches for foo; append  '! '  to  refresh local cache " :P luginclean      - confirms  removal of unused plugins; append  '! '  to auto-approve removal '  see :h vundle for more details or wiki for faq "Record the number of rows in history set  history=1000 "Show ruler Set ruler" set line number Set number "show current operation mode Set showmode" Always show status line of last window set  laststatus=2 "Sets the height of the command line  set cmdheight=2" when the cursor moves to the top and bottom of the buffer, keep 3 lines away set scrolloff=3 "displays white space between the split windows, Easy to read set fillchars=vert:/,stl:/,stlnc:/"Off error ring Set noerrorbells" Turn off use visual ring instead of call Set novisualbell " When Vim is being edited, if the command is wrong, a sound is emitted, and the setting removes the sound SET t_vb= "Do not show that aid Somalia children's prompt when starting  set shortmess=ati" syntax highlighting Syntax on "Color molokai" Color scheme colorscheme desert "background Set background=dark" underlines the line where the cursor is located set cursorline "Turn on the Highlight cursor column set  Cursorcolumn "Free space Delete set backspace=2" allows  backspace  and cursor keys to span line boundaries (not recommended) set whichwrap+=<,>,h,l "Replace Tabset expandtabset smarttab with a space" sets the line break auto indent to 4 spaces set shiftwidth=4 "Set the TAB key to 4 spaces set tabstop=4 "Set softtabstop=4" applies the alignment format of the current line to the next line set autoindent "When you encode in C, the auto-complete indent indents the inline code block SET&NBSP;CINDENTLET&NBSP;G: Rehash256 = 1let g:molokai_original = 1 " set the colorcolumn  highlight colorcolumn ctermbg=237 guibg=gray30 execute  "set colorcolumn=" &NBSP;.  join (Map (2,259),  ' "+"  . v:val '),  ', ') "Files,backups and encodingset  nobackupset noswapfileset autoreadset autowriteset autochdirset fileencodings= Utf-8set fileformats=unix,dos,mAcfiletype plugin onfiletype indent on "set showmatchset matchtime=2set  hlsearchset incsearchset ignorecaseset smartcaseset magicset lazyredrawset  nowrapscanset iskeyword+=_,$,@,%,#,-,. If has ("gui_running")     colorscheme  Solarizedendifset guifont=dejavu\sans\mono\15set guioptions=aegic "config TagList" lets taglist appear on the left of vim  tlist_use_right_window=1 "When multiple files are displayed at the same time, only the current file is displayed, the other files are collapsed let tlist_file_fold_auto_close=1" only displays the tag in one file , the default is to display more than one let tlist_show_one_file = 1 "tag collation, sorted by name. The default is to sort in the order in which they appear in the file let tlist_sort_type =  ' name '   ' taglist window is open and immediately switches to a focused state let tlist_ gainfocus_on_toggleopen = 1  "If the TagList window is the last window, exit vimlet tlist_exit_onlywindow =  1 "Set the form width to 32, you can set the let tlist_winwidth = 32 according to your preference" here is more important, set the location of Ctags let tlist_ctags_= '/ Bin/ctags ' "Hotkey setting, I set it to ctrl+t to exhale and close the TAGLISTMAP&NBSP;&LT;C-T&GT;&NBSP;:TLISTTOGGLE&LT Cr> "Set The nerd tree to automatically turn on Autocmd vimenter * nerdtree for Vim" when no specific file can be opened Nerdtreeautocmd &NBSP;STDINREADPRE&NBSP;*&NBSP;LET&NBSP;S:STD_IN=1AUTOCMD&NBSP;VIMENTER&NBSP;*&NBSP;IF&NBSP;ARGC ()  ==  0 && !exists ("s:std_in")  | nerdtree | endif "set shortcut key open nerdtree:ctrl+ Nmap <c-n> :nerdtreetoggle<cr> "off vim only one window opens Explorer autocmd bufenter * if   (Winnr ("$")  == 1 && exists ("B:nerdtree")  && b: Nerdtree.istabtree ())  | q | endif "sets different highlight function! nerdtreehighlightfile for different files ( EXTENSION,&NBSP;FG,&NBSP;BG,&NBSP;GUIFG,&NBSP;GUIBG) exec  ' autocmd filetype nerdtree  highlight  '  . a:extension . '  ctermbg= '.  a:bg . '  ctermfg= '.  a:fg . '  guibg= '.  a:guibg . '  guifg= ' . a:guifgexec  ' autocmd filetype nerdtree syn match  '  .& nbsp; a:extension&nbsp. '  #^\s\+.* '. a:extension . ' $# ' Endfunctioncall nerdtreehighlightfile (' Jade ',  ' green ',  ' none ',  ' green ',  ' #151515 ') Call nerdtreehighlightfile (' ini ',  ' yellow ',  ' none ',  ' yellow ',  ' #151515 ') call  Nerdtreehighlightfile (' MD ',  ' Blue ',  ' none ',  ' #3366FF ',  ' #151515 ') call  Nerdtreehighlightfile (' yml ',  ' yellow ',  ' none ',  ' yellow ',  ' #151515 ') call  Nerdtreehighlightfile (' config ',  ' yellow ',  ' none ',  ' yellow ', ' #151515 ') call  Nerdtreehighlightfile (' conf ',  ' yellow ',  ' none ',  ' yellow ',  ' #151515 ') call  Nerdtreehighlightfile (' json ',  ' yellow ',  ' none ',  ' yellow ',  ' #151515 ') call  Nerdtreehighlightfile (' HTML ',  ' yellow ',  ' none ',  ' yellow ',  ' #151515 ') call  Nerdtreehighlightfile (' styl ',  ' cyan ',  ' none ',  ' cyan ',  ' #151515 ') call  Nerdtreehighlightfile (' css ',  ' cyan ',  ' none ',  ' cyan ',  ' #151515 ') call nerdtreehighlightfile (' Coffee ',  ' red ',  ' none ',  ' red ',   ' #151515 ') call nerdtreehighlightfile (' js ',  ' Red ',  ' None ',  ' #ffa500 ',  ' #151515 ') Call nerdtreehighlightfile (' php ',  ' Magenta ',  ' None ',  ' #ff00ff ',  ' #151515 ') " Set these variables in Vim let g:nerdtreedirarrowexpandable =  ' let g:nerdtreedirarrowcollapsible =   ' let g:solarized_base16 = 1 ' Set progress bar theme Let g:airline_theme= "Luna"   "This is after installing fonts   This must be set to " let g:airline_powerline_fonts = 1   " to turn on the Tabline feature for easy viewing of buffer and switching, This function is quite good "" I also omitted the MINIBUFEXPL plug-in, because I am accustomed to 1 tabs under the use of multiple buffer "let g:airline#extensions#tabline#enabled =  1let g:airline#extensions#tabline#buffer_nr_show = 1 "Set Toggle buffer Shortcut" nnoremap <c-n>  :bn<CR>nnoremap <C-P> :bp<CR> ""   off status display blank symbol count, this is not very useful to me "let g: Airline#extensions#whitespace#enabled = 1let g:airline#extensions#whitespace#symbol =  '! ' " Latest status unless the sub-branch will not appear (within 1 minutes), so set to 2, will always appear set laststatus=2 "terminal default color 8 color, now set to 256 color support set t_co=256" Airline, the default is forbidden, So you need to add the following statement let g:airline#extensions#tabline#enabled = 1 "Separator can determine the independent progress bar, here is you define ' | ' Key let g:airline#extensions#tabline#left_sep =  '   ' Let g:airline#extensions#tabline#left _alt_sep =  ' | '


5, install plug-ins encountered various problems

Question 1: English can not understand (Baidu translation)

Issue 2: Directory does not know where Ann (one is # under the user, one is $ under the user, generally installed to $ under. VIRMC)

Question 3: What to do without the. vimrc file (please follow me)

Cdvim. VIMRC

Issue 4: I am not able to install the path I gave (delete the wrong thing to think about it, be sure to install on GitHub, do not look at the blog, most except, to two commands directly installed, not to help you become the vim of the Great God)

Issue 5: But the installation of a plug-in will be used (: Plugininstall to install)

See done!, you can peace of mind ~ ~ ~

Question 6: Beginner, just like me, do not want to dress a divine vim, with flowers, can use, and not ugly, and so really feel the VIM programming command is familiar, in go to toss it ~ ~ ~

6, vim Everyone in the installed plug-in has

(1) TagList: File structure

(2) The Nerd Tree: Resource Manager

(3) Airline: status bar

(4) CTRLP: Find tool

。。。。。。。。。。 There are too many vim plugins.

Various downloads or git clone please go to GitHub Search, the highest ranking is definitely what you want ~ ~ ~

7, I am equipped with vim, not good do not spray, to send flowers

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/82/3D/wKioL1dPDYnjOnmJAADDtMV2xKA438.png "title=" 2016-06-01 23-23-43 screen. png "alt=" Wkiol1dpdynjonmjaaddtmv2xka438.png "/>

This article from "Momo is spicy moe" blog, please be sure to keep this source http://momo462.blog.51cto.com/10138434/1785338

Vim configuration of the primary road---to create their own vim

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.