I use many plugin with VIM to boost development when I writing and debugging programs, which are written through PHP and Ruby languages. Also there are few plugin for SASS, RSpec and Javascript.
Below are configurations for my VIM editor and Vundle. There must some corresponded software be installed in the computer first and then these settings will work.
nnoremap means normal mode in VIM. Usage of <silent>
tag is to silently enter command mode of VIM. The followed <Leader>
or <leader>
tag means backslash symbol \
, and if <Leader>
or <leader>
is also followed by some literals, for example: <leader>
pcf, you can type \pcf
in normal mode of VIM to perform the task of PhpCsFixerFixFile()
.
===
set nu
syntax on
colorscheme jellybeans
" vim-syntastic setting
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" vim-syntastic setting
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" vim-syntastic setting for javascript checker
let g:syntastic_javascript_checkers = ['eslint']
" PHP-CS-FIXER for vim
" If you use php-cs-fixer version 2.x
let g:php_cs_fixer_rules = "@PSR2" " options: --rules (default:@PSR2)
"let g:php_cs_fixer_cache = ".php_cs.cache" " options: --cache-file
"let g:php_cs_fixer_config_file = '.php_cs' " options: --config
" End of php-cs-fixer version 2 config params
" PHP-CS-FIXER for vim
let g:php_cs_fixer_php_path = "php" " Path to PHP
"let g:php_cs_fixer_enable_default_mapping = 0 " Enable the mapping by default (<leader>pcd)
let g:php_cs_fixer_dry_run = 0 " Call command with dry-run option
let g:php_cs_fixer_verbose = 0 " Return the output of command if 1, else an inline information.
" Mapping keyboard key of PHP-CS-FIXER for vim
nnoremap <silent><leader>pcd :call PhpCsFixerFixDirectory()<CR>
nnoremap <silent><leader>pcf :call PhpCsFixerFixFile()<CR>
" autocomplete text
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" set indent
set autoindent
set expandtab
set softtabstop=4
set shiftwidth=4
set clipboard=unnamed
set nocompatible " be iMproved, required
filetype on " required
autocmd FileType ruby map <F9> :w<CR>:!ruby -c %<CR>
autocmd FileType ruby compiler ruby " compiler for ruby in vim-ruby
" Disable eclim to validate ruby code
let g:EclimRubyValidate = 0
" RSpec.vim mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" 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'
"===================================================
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
"Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin '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/'}
" Avoid a name conflict with L9
"Plugin 'user/L9', {'name': 'newL9'}
"===================================================
" vim for rails
Plugin 'tpope/vim-rails.git'
" VIM autocomplete
Plugin 'Valloric/YouCompleteMe'
" VIM for ruby
Plugin 'vim-ruby/vim-ruby'
" VIM for Dash.app in Mac
Plugin 'rizzatti/dash.vim'
" VIM for SASS
Plugin 'tpope/vim-haml'
" VIM for RSpec
Plugin 'thoughtbot/vim-rspec'
" VIM for phpcomplete-extended
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'Shougo/unite.vim'
Plugin 'Shougo/vimproc'
" VIM for php linter
Plugin 'joonty/vim-phpqa.git'
" Syntastic for VIM: vim-syntastic/syntastic
Plugin 'vim-syntastic/syntastic'
" PHP-CS-FIXER for VIM
Plugin 'stephpy/vim-php-cs-fixer'
" 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 - 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
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line