About my VIM configuration
Often write code on the server, a friend provided about his vim configuration, here to share to everyone.
Interface Effect Chart:
. VIMRC
The contents are as follows
"========================================================================= set nocompatible" be iMproved, required FileType off "required" Git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle.vim "Set" Runtime path to include Vundle and initialize set Rtp+=~/.vim/bundle/vundle.vim called Vundle#begin () "Let Vundle mana GE Vundle, required Plugin ' Gmarik/vundle.vim ' Plugin on GitHub repo ' Plugin shawncplus/phpcomplete.vim ' Plugin ' Scroo Loose/nerdtree ' Plugin ' kien/ctrlp.vim ' Plugin ' bling/vim-airline ' Plugin ' scrooloose/syntastic ' ' Plugin '
Doxygentoolkit.vim ' Plugin ' scrooloose/nerdcommenter ' Plugin ' marcweber/vim-addon-mw-utils ' Plugin ' Tomtom/tlib_vim ' Plugin ' garbas/vim-snipmate ' "Optional:plugin ' honza/vim-snippets '" Plugin from Http://vim-scripts.org/vim/script s.html Plugin ' vim-scripts/bufexplorer.zip ' Plugin ' vim-scripts/cscope.vim ' Plugin ' vim-scripts/taglist.vim ' Plugin ' Vim-scripts/winmanager ' "Plugin' Vim-scripts/project.tar.gz ' call Vundle#end () "Brief Help":P luginlist-lists configured plugins ":P Lugininsta Ll-installs plugins; Append '! ' to update or just:P luginupdate ':P luginsearch foo-searches for foo; Append '! ' to refresh the local cache ':P luginclean-confirms removal of unused plugins; Append '! ' to auto-approve removal filetype plugin on ' required syntax on ' automatic syntax highlighting set number ' shows line numbers set Cursorline "Highlight Current line" set ruler "open status bar ruler set shiftwidth=4" set << and >> the width of the command move is 4 set tabstop=4 expandtab "set tab length to 4 spaces set Nobackup override set IgnoreCase when you override set Autochdir to automatically toggle the current directory for the directory set Backupcopy=yes that contains the current file. ASE "searches for case insensitive, but remains case-sensitive set nowrapscan when there is one or more uppercase letters" Prohibit searching for "set Incsearch" when you search for a file to search for a search result set Hlsearch search Highlight the found text set Noerrorbells "Turn off error message Bell set Novisualbell" to turn off the use of visual bells instead of calling set t_vb= "terminal code set Magic with empty error tones" set magic set hidden "Allows you to switch buffers when there are unsaved modifications, at which time the change is held by Vim to save set guioptions-=t" Hide the toolbar set guioptIons-=m "Hide Menu bar set smartindent" open new row using Smart Auto indent set Backspace=indent,eol,start "Do not set the backspace and delete keys to delete the return set in the Insert State Cmdheig Ht=1 "Set the number of lines on the command line to 1 set laststatus=2" Displays the status bar (default is 1, the status bar cannot be displayed) set statusline=\%<%f[%1*%m%*%n%r%h]%=\%y\%0 (%{&fil eformat}\%{&encoding}\%c:%l/%l%) \ Set the information displayed on the status line set errorformat=%m\ in\%f\ on\ line\%l set autoindent set Softtab Stop=4 "so that when you press the BACKSPACE button, you can delete 4 spaces at a time ColorScheme Molokai set t_co=256"----------------------------------------------------- ------------"Get current system type"------------------------------------------------------------------function! Mysys () If has ("Win16") | | Has ("Win32") | | Has ("Win64") | | Has ("Win95") return "Windows" ElseIf has ("UNIX") return "Linux" endif endfunction "user directory variable $vimfiles if Mysys () = = "Windows" let $VIMFILES = $VIM. ' /vimfiles ' Set backupdir=d://vim/tmp elseif mysys () = = "Linux" let $VIMFILES = $HOME. ' /.vim ' Set backupdir=/tmp endif ' Set font and Chinese support if has ("Win32") set GUIFONT=INCONSOLATA:H12:CANSI endif "Configure the multilingual Environment if has (" Multi_byte ")" UTF-8 encoded set Encoding=utf-8 set Termencoding=utf-8 set formatoptions +=MM set FENCS=UTF-8,GBK if V:lang =~? ' ^\ (zh\) \|\ (ja\) \|\ (ko\) ' Set ambiwidth=double endif if has ("Win32") source $VIMRUNTIME/delmenu.vim Sour Ce $VIMRUNTIME/menu.vim language messages Zh_cn.utf-8 endif else Echoerr "Sorry, this version of (g) Vim is not co Mpiled with +multi_byte "endif" cursor to the upper window, need <c-w><c-w>k, very troublesome, now remapping to <c-k> Nnoremap <C-h> <c-w >h nnoremap <C-j> <c-w>j nnoremap <C-k> <c-w>k nnoremap <C-l> <c-w>l "some good mapping translation syntax (Useful if you mix different languages in one file) nnoremap <leader>1:set filetype=xhtml<cr> nnoremap <leader>2:set filetype=css <CR> nnoremap <leader>3:set filetype=javascript<cr> nnoremap <leader>4:set filetype=php< Cr> "-----------------------------------------------------------------" Folding Configuration "manual manually define folding" indent moreIndentation represents a higher level of collapse "expr defines the collapse with an expression" syntax the syntax highlighting to define the collapse "diff collapses the text that has not changed" marker the flags in the text--------------------------------- ---------------------------------set foldenable set foldmethod=manual set foldlevel=100 "Do not automatically collapse code set when you start Vim Foldcolumn =0 "Set Folding bar width" General settings for Python files, such as Don't tab "Autocmd FileType python set tabstop=4 shiftwidth=4 expandtab" Autocmd file Type python map <F12>:!python%<cr> "Set the path set Complete-=k complete+=k" of the data dictionary ~/.vim/dict/file Autocmd filety PE JavaScript set dictionary= $VIMFILES/dict/javascript.dict "Autocmd filetype css set dictionary= $VIMFILES/dict/ Css.dict au FileType php setlocal dict+= $VIMFILES/dict/php.dict "--------------------------------------------------- --------------"Plugin-winmanager configuration (deprecated, many small bugs)"---------------------------------------------------------------- -"Let g:winmanagerwindowlayout=" nerdtree,taglist "' let G:winmanagerwidth = ' let g:nerdtree_title= ' [NERDTree] '" " Nmap <silent> <C-m>: If ISWINMAnagervisible () <BAR> wmtoggle<cr> <BAR> Else <BAR> wmtoggle<cr>:q<cr> endif < Cr> "" Nmap <C-m>:wmtoggle<cr> "" function! Nerdtree_start () "Exec ' Nerdtree '" "Endfunction" "function! Nerdtree_isvalid () "Return 1" endfunction "-----------------------------------------------------------------" plug In-doxygen Toolkit Configuration "-----------------------------------------------------------------let G:doxygentoolkit_ Brieftag_pre= "@brief" Let g:doxygentoolkit_paramtag_pre= "@Param" Let g:doxygentoolkit_returntag= "@return" Let G:doxy Gentoolkit_authorname= "Jiangyh <jiangyahui@360.cn>" let g:doxygentoolkit_brieftag_funcname= "no" let G:doxygen _enhanced_color=1 map fg:dox<cr> Map ffg:doxauthor<cr> "-------------------------------------------- ---------------------"Plugin-nerdtree Configuration"-----------------------------------------------------------------let Nerdtreewinpos= "left" let nerdtreewinsize=30 " Let nerdtreechdirmode=1 "change the tree directory at the same time change the project directory Nnoremap <silent><F6>:nerdtreetoggle<cr>"----------- ------------------------------------------------------"Plugin-ctags Program"---------------------------------------- -------------------------if mysys () = = "Windows" Let Tlist_ctags_cmd = ' "'. $VIMRUNTIME. '
/ctags.exe "' ElseIf mysys () = =" Linux "let Tlist_ctags_cmd = '/usr/bin/ctags ' endif set tags=~/acl/tags; Nnoremap <silent><F8>:!ctags-r--exclude=*.js--c++-kinds=+p--fields=+ias--extra=+q "----- ------------------------------------------------------------"Plugin-taglist.vim"------------------------------ -----------------------------------Let Tlist_show_one_file = 1 "Do not display multiple files at the same time tag, only show the current file let Tlist_exit_onlywindow = 1" such as Fruit TagList window is the last window, then quit vim let Tlist_use_right_window = 1 "Display the TagList window in the right window let tlist_file_fold_auto_close=1" Automatically collapses the list of methods for the current non-editing file let Tlist_auto_open = 0 let tlist_auto_update = 1 let tlist_hightlight_tag_On_bufenter = 1 Let tlist_enable_fold_column = 0 let Tlist_compact_format = 1 "Let Tlist_display_prototype = 0 Nnoremap <silent><F7>:tlisttoggle<cr> "--------------------------------------------------------------- --"Plugin-cscope settings"-----------------------------------------------------------------set cscopequickfix=s-,c-,d- , I-,t-,e-if has ("Cscope") set Csprg=/usr/bin/cscope set csto=1 set CST set Nocsverb "Add any dat Abase in current directory "if Filereadable (" Cscope.out ")" CS Add Cscope.out "endif" Set Csverb " endif nmap <c-@>s:cs Find S <c-r>=expand ("<cword>") <CR><CR> nmap <c-@>g : CS Find G <c-r>=expand ("<cword>") <CR><CR> nmap <c-@>c:cs find C <c-r>=expand (" ;cword> ") <CR><CR> nmap <c-@>t:cs find T <c-r>=expand (" <cword> ") <CR><CR > Nmap <c-@>e:cs Find e <c-R>=expand ("<cword>") <CR><CR> nmap <c-@>f:cs find F <c-r>=expand ("<cfile>") <CR><CR> nmap <c-@>i:cs Find I <c-r>=expand ("<cfile>") <CR><CR> nmap <c-@ >d:cs Find D <c-r>=expand ("<cword>") <CR><CR> endif "------------------------------------ -----------------------------the PLUGIN-PROJECT.VIM organization Project list \c recursively read subdirectories \c read the current file \l (list all current layer files) \l (recursive), press any key to stop "\w" (Close when Front-level file) \w (Recursive) "\g (search in the current layer of the project) \g (recursive)" \ r close subfolders and refresh the files under the current folder. \ r recursively open the folder and refresh all Files "\s closes the folder and creates, \s recursively opens the folder and creates" \s display files horizontally open multiple windows
, open or close the Folder List "\o opens the file in a window, open or close the Folder List" \v in the right window displays the pointer rest in the file contents of the Project window "\i display the settings parameters for a file or folder, such as filter=" * "\i the decision path and parameters for displaying a file or folder "\1-\9,\f1-\f9,\f1-\f9 Execute the specified command, the query 1-9 command, \f0 query f1-f9,f1-f9 command" <space> space to enlarge the width of the project window, restore width "----------------- ------------------------------------------------"Let-proj_window_width=24" let-proj_window_increment=12 "let loaded _project = 1 "Deactivate the cartridge" let proj_flags= imSTCG "Automatically hides the project list" Nnoremap <silent><F5>:P roject<cr> "F5 Open Project Window"----------------------- ------------------------------------------"Plugin-nerd_commenter.vim Annotation Code," [count],cc the following count line adds a comment line by row (7,CC) "[ COUNT],CU the following count line to uncomment (7,CU) "[COUNT],CM cursor the following count line attempts to add a block comment (7,cm)", the CA inserts */* At the end of a line, and enters insert mode.
This command facilitates the writing of annotations. "NOTE: The count parameter is optional, none is default to the selected row or current line"-----------------------------------------------------------------let nerdspacedelims= 1 "lets the annotation character and the statement leave a space let Nerdcompactsexycoms=1" when the multiline annotation looks better look "---------------------------------------------------------- -------"PLUGIN-CTRLP settings"-----------------------------------------------------------------nnoremap <silent>
<C-p>:clearallctrlpcache<cr>\|:ctrlp<cr>
Use steps:
1. Download Plugin Manager
~/.vim/bundle/vundle.vim
2, install the plugin
Open a file
Vim ~/.VIMRC
Enter command to perform installation
: Bundleinstall
3, upload PHP automatic instance dictionary and color scheme , extract to. Vim Directory
The above is the detailed process of configuring VIM, I hope to help you learn.