Configure VIM to make it more conducive to PHP development

Source: Internet
Author: User
Tags upload php
This article mainly introduces the PHP engineers to configure the detailed process of vim, both Vim configuration, but also shared the Vim configuration code, interested in the small partners can refer to. We hope to help you.

About my VIM configuration

Often write code on the server, a friend provides a vim configuration about him, here to share to everyone.

Interface:

. VIMRC

The contents are as follows

"=========================================================================set nocompatible" be iMproved, REQUIREDF Iletype off "required" Git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle.vim "set the Runt  IME path to include Vundle and Initializeset Rtp+=~/.vim/bundle/vundle.vim call Vundle#begin () "Let Vundle manage Vundle, Requiredplugin ' Gmarik/vundle.vim ' "plugin on GitHub repoplugin ' shawncplus/phpcomplete.vim ' plugin ' scrooloose/ Nerdtree ' Plugin ' kien/ctrlp.vim ' Plugin ' bling/vim-airline ' Plugin ' scrooloose/syntastic ' Plugin ' vim-scripts/ 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/ Scripts.htmlplugin ' 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 Lugininstall-installs plugins; Append '! ' to update or just:P luginupdate ":P luginsearch foo-searches for foo; Append '! ' to refresh 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 "show line numbers set Cursorline" highlight  The current line "set ruler" opens the status bar ruler set shiftwidth=4 "Settings << and >> command width 4set tabstop=4 expandtab" Setting tab length is 4 spaces set Nobackup "Overwrite files without backing up" set Autochdir "automatically switches the current directory to the directory where the current file is located set Backupcopy=yes" set backup behavior when overwriting set ignorecase smartcase "Ignore size when searching Write, but is still case sensitive when there is one or more capital letters set Nowrapscan "Prohibit search to the end of a file when searching for" set Incsearch "when searching for content is displayed when search results set Hlsearch" Search highlighting the found text set n Oerrorbells "Turn off error message ring set Novisualbell" Turn off use visual ring instead of call set t_vb= "null error ringtone" Terminal code set Magic "setting magic Set hidden" allows the buffer to be toggled when there are unsaved modifications, At this time the modification is held by VIM to save set guioptions-=t "Hide toolbar set guioptions-=m" Hide Menu bar set smartindent "Turn on new row using Smart Auto indent set Backspace=indent,eoL,start "Do not set in insert state cannot use BACKSPACE and delete key to remove carriage return set cmdheight=1" SET command line line number is 1set laststatus=2 "Display status bar (default is 1, cannot display status bar) set Statusli Ne=\%<%f[%1*%m%*%n%r%h]%=\%y\%0 (%{&fileformat}\%{&encoding}\%c:%l/%l%) \ "Sets the information displayed in the status line set errorformat=% m\ in\%f\ on\ line\%lset autoindent Set softtabstop=4 "allows you to delete 4 spaces at a time by pressing BACKSPACE colorscheme molokaiset t_co=256"----------- ------------------------------------------------------"Get current system type"----------------------------------------------- -------------------function! Mysys () If has ("Win16") | | Has ("Win32") | | Has ("Win64") | | Have ("Win95") return "Windows" ElseIf has ("UNIX") return "Linux" endifendfunction "user Directory variable $vimfilesif mysys () = =" W indows "Let $VIMFILES = $VIM. ' /vimfiles ' Set Backupdir=d://vim/tmpelseif mysys () = = "Linux" let $VIMFILES = $HOME. ' /.vim ' Set Backupdir=/tmpendif ' set font and Chinese support if has ("Win32") set GUIFONT=INCONSOLATA:H12:CANSIENDIF "Configure multi-language environment if has (" mult I_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 Source $VI Mruntime/menu.vim language messages Zh_cn.utf-8 endifelse echoerr "Sorry, this version of (g) Vim is not compiled wit H +multi_byte "endif" cursor to the top window, need to <c-w><c-w>k, very cumbersome, now remap to <c-k>nnoremap <C-h> <C-w> Hnnoremap <C-j> <c-w>jnnoremap <C-k> <c-w>knnoremap <C-l> <c-w>l " Some good mapping conversion syntax (useful if a different language is mixed in a 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> "-----------------------------------------------------------------" Collapse Configuration "" Manual manually Define folding " Indent more indentation means a higher level of collapse "expr uses expressions to define collapse" syntax use syntax highlighting to define collapsed "diff to collapse text without changes" marker the flag in the text is collapsed-------------------------- ----------------------------------------Set Foldenableset foldmethod=manualset foldlevel=100 "Start vim do not automatically collapse code set foldcolumn=0" Set the folding column width "Python file general settings, such as do not tab, etc. "Autocmd FileType python set tabstop=4 shiftwidth=4 expandtab" autocmd FileType python map <F12>:!python%&L T Cr> "Set data dictionary ~/.vim/dict/file path set complete-=k complete+=k" Autocmd filetype JavaScript set dictionary= $VIMFILES/dict/ Javascript.dict "Autocmd filetype css set dictionary= $VIMFILES/dict/css.dictau filetype php setlocal dict+= $VIMFILES/ Dict/php.dict "-----------------------------------------------------------------" Plugin-winmanager configuration (deprecated, many minor bugs) "-----------------------------------------------------------------" Let g:winmanagerwindowlayout= "Nerdtree, TagList "Let G:winmanagerwidth = +" Let g:nerdtree_title= "[Nerdtree]" "" Nmap <silent> <C-m>: If Iswinmanage Rvisible () <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 "-----------------------------------------------------------------" Plugin-doxygen Toolkit Configuration "-----------------------------------------------------------------let G:doxygentoolkit_ Brieftag_pre= "@brief" Let g:doxygentoolkit_paramtag_pre= "@Param" Let g:doxygentoolkit_returntag= "@return" Let G:d Oxygentoolkit_authorname= "* * *" 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 directory of the tree while changing the catalog of the project 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 <silen T><f8>:!ctags-r--exclude=*.js--c++-kinds=+p--fields=+ias--extra=+q .<cr> "----------------------- ------------------------------------------"Plugin-taglist.vim"------------------------------------------------ -----------------Let Tlist_show_one_file = 1 "does not display the tag of multiple files at the same time, only show let Tlist_exit_onlywindow = 1" of the current file if the TagList window is the last window, Exit Vimlet Tlist_use_right_window = 1 "Show TagList window in the right window let tlist_file_fold_auto_close=1" automatically collapse the current list of non-edited files let Tlist_ Auto_Open = 0let Tlist_auto_update = 1let Tlist_hightlight_tag_on_bufenter = 1let Tlist_enable_fold_column = 0let Tlist_Co Mpact_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 database in current directory" if Filere Adable ("Cscope.out") "CS Add Cscope.out" endif "set Csverb" EndIf nmap <c-@>s:cs find S &LT ; 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>") &LT;CR><cr>endif "-----------------------------------------------------------------" Plugin-project.vim organization Project List "\c recursive read subdirectory \c read current File" \l (List all current layer files) \l (recursive), press any key to stop "\w (close current layer file) \w (Recursive)" \g (search in project current layer file) \g (recursive) "\ r close subfolders and refresh files under current folder, \ r recursive Open folder and Refresh All Files "\s close the folder and create, \s Open the folder recursively and create" \s to open the file in multiple windows, open or close the Folder List "\o Open the file in a window, open or close the folder List" \v In the right window, the pointer rests on the file contents of the Project window "\i displays the file or folder's set parameters, such as filter=" * "" \i show file or folder in the path and parameters "\1-\9,\f1-\f9,\f1-\f9 Execute the specified command, \ Query 1-9 command , \f0 Query f1-f9,f1-f9 command "<space> space expands the width of the project window, restores width"-------------------------------------------------------  ----------' let proj_window_width=24 ' let proj_window_increment=12 ' let Loaded_project = 1 ' Deactivate the rack "let proj_flags=" IMSTCG " "Automatically Hide project list" Nnoremap <silent><F5>:P roject<cr> "F5 Open Project Window"------------------------------ -----------------------------------"Plugin-nerd_commenter.vim Comment Code," [COUNT],CC cursor the following count line adds comments (7,CC) "[Count], CU cursor following count line uncomment (7,CU) "[count],cm Cursor following count line attempt to add block Comment (7,cm)", CA at end of line Insert/* */, and enters insert mode. This command makes it easy to write comments. Note: The count parameter is optional, none defaults to the selected row or the current line-----------------------------------------------------------------let nerdspacedelims= 1 "Leave a space between the comment and the statement let Nerdcompactsexycoms=1" look better when the multiline comment---------------------------------------------------------- -------"PLUGIN-CTRLP settings"-----------------------------------------------------------------nnoremap <silent> <C-p>:clearallctrlpcache<cr>\|:ctrlp<cr>

Steps to use:
1. Download the plugin Manager
~/.vim/bundle/vundle.vim
2, install the plug-in
Open a file
Vim ~/.VIMRC
Enter the command to perform the installation
: Bundleinstall
3, upload PHP automatic instance dictionary and color scheme
, unzip to. Vim Directory

Related recommendations:

Use of the Global substitution command in the VIM editor

Vim Common configuration-make vim more usable

Examples of VIM document editor in Linux

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.