PHP 엔지니어 VIM 설정 공유

13066 단어 PHPVIM
나의 vim 설정
서버 에 코드 를 자주 쓰 고 한 친구 가 그 에 대한 vim 설정 을 제공 하여 공유 합 니 다.
인터페이스 효과 도:
.vimrc
내용 은 아래 와 같다 

"=========================================================================
set nocompatible       " be iMproved, required
filetype off         " required
 
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
 
call vundle#begin()
 
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
 
" plugin on GitHub repo
Plugin '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.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
" :PluginList    - lists configured plugins
" :PluginInstall  - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean   - confirms removal of unused plugins; append `!` to auto-approve removal
 
filetype plugin on  " required
 
syntax on "       
set number "     
set cursorline "        
" set ruler "        
set shiftwidth=4 "    <<   >>           4
set tabstop=4 expandtab "    tab     4    
set nobackup "         
" set autochdir "                   
set backupcopy=yes "            
set ignorecase smartcase "         ,                      
set nowrapscan "                
" set incsearch "               
set hlsearch "              
set noerrorbells "         
set novisualbell "             
set t_vb= "            
set magic "     
set hidden "                 ,       vim     
set guioptions-=T "      
set guioptions-=m "      
set smartindent "              
set backspace=indent,eol,start "                 Delete       
set cmdheight=1 "           1
set laststatus=2 "       (     1,        )
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\ "            
set errorformat=%m\ in\ %f\ on\ line\ %l
set autoindent 
set softtabstop=4 "               4    
 
colorscheme molokai
set t_Co=256
 
 
"-----------------------------------------------------------------
"         
"------------------------------------------------------------------
function! MySys()
  if has("win16") || has("win32") || has("win64") || has("win95")
    return "windows"
  elseif has("unix")
    return "linux"
  endif
endfunction
 
"       $VIMFILES
if MySys() == "windows"
  let $VIMFILES = $VIM.'/vimfiles'
  set backupdir=D://Vim/tmp
elseif MySys() == "linux"
  let $VIMFILES = $HOME.'/.vim'
  set backupdir=/tmp
endif
 
"            
if has("win32")
  set guifont=Inconsolata:h12:cANSI
endif
 
"        
if has("multi_byte")
  " UTF-8   
  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 $VIMRUNTIME/menu.vim
    language messages zh_CN.utf-8
  endif
else
  echoerr "Sorry, this version of (g)vim was not compiled with +multi_byte"
endif
 
"        ,  <c-w><c-w>k,    ,      <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
 
"           (                  )
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>
 
"-----------------------------------------------------------------
"     
"
" manual       
" indent               
" expr          
" syntax           
" diff             
" marker         
"------------------------------------------------------------------
set foldenable
set foldmethod=manual
set foldlevel=100 "   vim         
set foldcolumn=0 "        
 
 
" Python        ,     tab  
" autocmd FileType python set tabstop=4 shiftwidth=4 expandtab
" autocmd FileType python map <F12> :!python %<CR>
 
"        ~/.vim/dict/     
set complete-=k complete+=k
" autocmd filetype 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    (  ,   bug)
"-----------------------------------------------------------------
" let g:winManagerWindowLayout="NERDTree,TagList"
" let g:winManagerWidth = 35
" 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
 
 
"-----------------------------------------------------------------
" plugin - doxygen toolkit   
"-----------------------------------------------------------------
let g:DoxygenToolkit_briefTag_pre="@brief "
let g:DoxygenToolkit_paramTag_pre="@Param " 
let g:DoxygenToolkit_returnTag="@return "
 
let g:DoxygenToolkit_authorName="jiangyh <[email protected]>"
let g:DoxygenToolkit_briefTag_funcName="no"
let g:doxygen_enhanced_color=1
 
map fg : Dox<cr>
map ffg : DoxAuthor<cr>
 
 
"-----------------------------------------------------------------
" plugin - NERDTree   
"-----------------------------------------------------------------
let NERDTreeWinPos="left"
let NERDTreeWinSize=30
" let NERDTreeChDirMode=1 "   tree            
 
nnoremap <silent><F6> :NERDTreeToggle<CR>
 
"-----------------------------------------------------------------
" plugin - ctags  
"-----------------------------------------------------------------
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 .<CR>
 
 
"-----------------------------------------------------------------
" plugin - taglist.vim 
"-----------------------------------------------------------------
let Tlist_Show_One_File = 1 "           tag,        
let Tlist_Exit_OnlyWindow = 1 "   taglist         ,   vim
let Tlist_Use_Right_Window = 1 "         taglist  
let Tlist_File_Fold_Auto_Close=1 "                 
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  
"-----------------------------------------------------------------
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 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
 
 
"-----------------------------------------------------------------
" plugin - project.vim       
" \C         \c       
" \l (         )\L(  ),      
" \w (       )\W(  )
" \g (          )\G(  )
" \r                  ,\R              
" \s         ,\S          
" \s               ,          
" \o           ,          
" \v            project       
" \i              , filter="*"
" \I                 
" \1 - \9,\f1-\f9,\F1-\F9      ,\0  1-9  ,\f0  f1-f9,F1-F9  
" <space>    project     ,    
"-----------------------------------------------------------------
" let proj_window_width=24
" let proj_window_increment=12
" let loaded_project = 1 "     
" let proj_flags="imstcg" "     project  
" nnoremap <silent><F5> :Project<CR> " F5   project  
 
 
"-----------------------------------------------------------------
" plugin - NERD_commenter.vim       ,
" [count],cc     count       (7,cc)
" [count],cu     count       (7,cu)
" [count],cm     count        (7,cm)
" ,cA       /* */,        。          。
"  :count    ,            
"-----------------------------------------------------------------
let NERDSpaceDelims=1 "               
let NERDCompactSexyComs=1 "           
 
"-----------------------------------------------------------------
" plugin - ctrlp   
"-----------------------------------------------------------------
nnoremap <silent> <C-p> :ClearAllCtrlPCache<CR>\|:CtrlP<CR>

사용 절차:
1.플러그 인 관리자 다운로드
 ~/.vim/bundle/Vundle.vim
2.플러그 인 설치
파일 열기
vim ~/.vimrc
명령 실행 설치 에 들 어가 기
:BundleInstall
3.PHP 자동 인 스 턴 스 사전 및 본색 방안 을 업로드 하여.vim 디 렉 터 리 로 압축 해제

이상 은 VIM 을 설정 하 는 상세 한 과정 입 니 다.여러분 의 학습 에 도움 이 되 기 를 바 랍 니 다.

좋은 웹페이지 즐겨찾기