Ubuntu gVim PHP开发平台安装和配置大屏查看

发布于:2016年01月30日 已被阅读


gVim安装安装只需一个命令:
sudo apt-get install vim-gtk
下面重点讲插件的安装和配置。


要安装的插件包括:
nerdtree:文件和目录浏览。
ctrlp.vim: 代码和文件模糊查找。
syntastic:支持各种语言的语法检查。
fugitive:git集成。
PIV: PHP集成环境,自动产生PHP文档,Shift+K查看PHP函数文档。
tagbar:函数列表。
ultisnips:提供代码模板功能,但不包含各语言的代码模板。
vim-snippets:提供各种语言的ultisnips的代码模板。
youcompleteme:无处不在的自动补齐
supertab:让ultisnips与youcompleteme协同工作
vim-airline:强大的状态栏。
echofunc:了解函数参数。
vim-twig:Twig模板支持。
vim-css-color:所见及所得的CSS颜色。
vdebug:PHP、Python等可视化调试。
vim-gitgutter:显示文件每一行的修改状态。


通过apt-get安装Ubuntu提供的插件

Ubuntu已经提供了youcompleteme等插件,可以直接安装:
$ sudo apt-get install vim-youcompleteme 
$ vim-addons install youcompleteme


安装matchit插件:
$ vim-addons install matchit


Ubuntu15.04已经提供了fugitive和syntastic等插件,可以直接安装:
$ sudo apt-get install vim-fugitive vim-syntastic vim-ctrlp vim-ultisnips vim-snippets
$ vim-addons install ctrlp
(对于Ubuntu15.04以前的版本,这些插件只能通过Vundle安装)

tagbar要用到ctags,需要先安装:
$ sudo apt-get install exuberant-ctags


其他插件需要通过Vundle安装,先安装Vundle
mkdir ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim


编辑~/.vimrc配置Vundle:
set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

Plugin 'scrooloose/nerdtree'
Plugin 'spf13/PIV' " PHP Integration environment
Plugin 'majutsushi/tagbar'
Plugin 'bling/vim-airline' " Status line
Plugin 'mbbill/echofunc'
Plugin 'evidens/vim-twig'
Plugin 'ap/vim-css-color'
Plugin 'airblade/vim-gitgutter' " Git status for each line
Plugin 'joonty/vdebug' " DBGP debugger
Plugin 'ervandew/supertab'

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

如果是Ubuntu 15.04以前的版本,这些插件也需要通过Vundle安装:
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-fugitive' " Git wrapper
Plugin 'kien/ctrlp.vim'" Fuzzy file, buffer, mru, tag, etc finder.
Plugin 'sirver/ultisnips'
Plugin 'honza/vim-snippets'" Snippets for snipmate


然后重新启动gVim并运行:
:PluginInstall
完成插件的最后安装



(1)

    插件的配置
    编辑~/.vimrc在里面添加插件的配置:
    " NERDTree
    map <C-n> :NERDTreeToggle<CR>
    " Tagbar
    nmap <F8> :TagbarToggle<CR>
    " AirLine
    set laststatus=2

    " make YCM compatible with UltiSnips (using supertab)
    let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
    let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
    let g:SuperTabDefaultCompletionType = '<C-n>'

    " better key bindings for UltiSnipsExpandTrigger
    let g:UltiSnipsExpandTrigger = "<tab>"
    let g:UltiSnipsJumpForwardTrigger = "<tab>"
    let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"



    收起回复

      这是我的完整的~/.vimrc文件:


      set nocompatible " be iMproved, required
      filetype off " required

      " set the runtime path to include Vundle and initialize
      set rtp+=~/.vim/bundle/Vundle.vim
      call vundle#begin()
      " alternatively, pass a path where Vundle should install plugins
      "call vundle#begin('~/some/path/here')

      " let Vundle manage Vundle, required
      Plugin 'gmarik/Vundle.vim'

      Plugin 'scrooloose/nerdtree'
      Plugin 'spf13/PIV' " PHP Integration environment
      Plugin 'majutsushi/tagbar'
      Plugin 'bling/vim-airline' " Status line
      Plugin 'mbbill/echofunc'
      Plugin 'evidens/vim-twig'
      Plugin 'ap/vim-css-color'
      Plugin 'airblade/vim-gitgutter' " Git status for each line
      Plugin 'joonty/vdebug' " DBGP debugger
      Plugin 'ervandew/supertab'

      " All of your Plugins must be added before the following line
      call vundle#end() " required
      filetype plugin indent on " required
      " To ignore plugin indent changes, instead use:
      "filetype plugin on
      "
      " Brief help
      " :PluginList - list configured plugins
      " :PluginInstall(!) - install (update) plugins
      " :PluginSearch(!) foo - search (or refresh cache first) for foo
      " :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
      "
      " see :h vundle for more details or wiki for FAQ
      " Put your non-Plugin stuff after this line

      if has("gui_gtk2")
      set guifont=DejaVu\ Sans\ Mono\ 12
      end

      set expandtab
      set tabstop=2
      set shiftwidth=2
      set autoindent
      set smartindent

      if has("autocmd")
      " Drupal *.module and *.install files.
      augroup module
      autocmd BufRead,BufNewFile *.module set filetype=php
      autocmd BufRead,BufNewFile *.install set filetype=php
      autocmd BufRead,BufNewFile *.test set filetype=php
      autocmd BufRead,BufNewFile *.inc set filetype=php
      autocmd BufRead,BufNewFile *.profile set filetype=php
      autocmd BufRead,BufNewFile *.view set filetype=php
      autocmd BufRead,BufNewFile *.theme set filetype=php
      augroup END
      endif
      syntax on

      autocmd FileType php set omnifunc=phpcomplete#CompletePHP

      let php_parent_error_close = 1
      let php_parent_error_open = 1
      let php_folding = 1

      set number
      set hlsearch
      filetype indent on
      set fileencodings=ucs-bom,utf-8,gbk,default,utf8
      set encoding=utf-8

      " NERDTree
      map <C-n> :NERDTreeToggle<CR>
      " Tagbar
      nmap <F8> :TagbarToggle<CR>
      " AirLine
      set laststatus=2

      " make YCM compatible with UltiSnips (using supertab)
      let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
      let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
      let g:SuperTabDefaultCompletionType = '<C-n>'

      " better key bindings for UltiSnipsExpandTrigger
      let g:UltiSnipsExpandTrigger = "<tab>"
      let g:UltiSnipsJumpForwardTrigger = "<tab>"
      let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"

      colorscheme desert



      收起回复


        最新发布
        linux下svn提交忽略某些文件... (173)
        使用批处理来批量更新、提交SVN... (136)
        linux查看目录文件大小命令 (145)
        linux tar打包压缩排除某个... (134)
        Linux tar压缩和解压 (192)
        SVN子命令add用法浅析 (130)
        热门博文
        网友FBI探案:马蓉iPad惊人发现... (43345)
        霍金携手俄罗斯富豪耗资1亿美元寻找外... (4747)
        如何才能查看PHP内置函数源代码... (1209)
        微信支付开发当前URL未注册的解决方... (574)
        《谁为爱情买单》中的经典面试 ... (441)
        让虚拟主机也用上SVN:适用于个人的... (395)
        精华博文
        [推荐]Centos7 安装配置 SVN (159)
        easyswoole框架安装 (174)
        php开启pecl的支持(推荐) (157)
        1-10个恋爱表现:男朋友爱你程度到... (164)
        女生喜欢你的10个程度,到第六个就可... (141)
        Eclipse 没有Server选项... (211)
        友情链接
        我来忙 (110)