Skip to content

Instantly share code, notes, and snippets.

@petrenkorf
Last active February 11, 2020 13:14
Show Gist options
  • Save petrenkorf/3f3fd85bc05d768d47f2c95aaa6a4548 to your computer and use it in GitHub Desktop.
Save petrenkorf/3f3fd85bc05d768d47f2c95aaa6a4548 to your computer and use it in GitHub Desktop.
Simple vim config for PHP projects (WIP)
set nocompatible
set nowrap
set autoread
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'majutsushi/tagbar'
Plugin 'arnaud-lb/vim-php-namespace'
Plugin 'ctrlpvim/ctrlp.vim'
" Plugin 'craigemery/vim-autotag'
Plugin 'gmarik/Vundle.vim'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'leafgarland/typescript-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-endwise'
Plugin 'vim-ruby/vim-ruby'
Plugin 'wavded/vim-stylus'
Plugin 'mattn/emmet-vim'
Plugin 'alvan/vim-closetag'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'vim-vdebug/vdebug'
Plugin 'neomake/neomake'
Plugin 'thoughtbot/vim-rspec'
Plugin 'luochen1990/rainbow'
Plugin 'tpope/vim-fireplace'
Plugin 'jiangmiao/auto-pairs'
Plugin 'liuchengxu/space-vim-dark'
Plugin 'posva/vim-vue'
Plugin 'tobyS/pdv'
Plugin 'tobyS/vmustache'
Plugin 'janko/vim-test'
" Optional:
Plugin 'honza/vim-snippets'
Plugin 'dracula/vim'
call vundle#end()
call neomake#configure#automake('nrwi', 500)
filetype plugin indent on
function! IPhpInsertUse()
call PhpInsertUse()
call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <Leader>u <Esc>:call IPhpInsertUse()<CR>
autocmd FileType php noremap <Leader>u :call PhpInsertUse()<CR>
function! IPhpExpandClass()
call PhpExpandClass()
call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <Leader>e <Esc>:call IPhpExpandClass()<CR>
autocmd FileType php noremap <Leader>e :call PhpExpandClass()<CR>
autocmd FileType php inoremap <Leader>s <Esc>:call PhpSortUse()<CR>
autocmd FileType php noremap <Leader>s :call PhpSortUse()<CR>
" --- general settings ---
set ruler
set showcmd
set incsearch
set hlsearch
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set swapfile
set dir=~/tmp
" autocmd vimenter * NERDTree
let g:rainbow_active=1
let g:autotagTagsFile="tags"
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|node_modules$\|vendor$\|storage$\|public\/vendor$\|public_html\/node_modules|public_html\/js\/vendor|coverage$|public_html\/var$',
\ 'file': '\v\.(exe|so|dll|swp|json|ttf|svg|woff|eot|png|jpeg|jpg|gif)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
let g:vdebug_options = {
\ 'path_maps': {
\ '/var/www/': '/home/petris/Projects/embraed/webapp',
\ },
\ }
let g:pdv_template_dir = $HOME ."/.vim/bundle/pdv/templates_snip"
" let g:snipMate.snippet_dirs = [ '~/.vim/bundle/vim-snippets/snippets' ]
" ----------- tags
set tags+=tags,vendortags
syntax on
color dracula
" color space-vim-dark
autocmd BufWritePost * !ctags -f tags --verbose --languages=PHP -R app --php-kinds=cdfi -a
" ------------ maps
" 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>
nmap t<C-f> :TestFile<CR>
nmap <C-f> :tag<space>
" nmap <F8> :TagbarToggle<CR>
nmap <F8> :NERDTreeToggle<CR>
noremap <silent> <C-S> :update<CR>
vnoremap <silent> <C-S> <C-C>:update<CR>
inoremap <silent> <C-S> <C-O>:update<CR>
map <C-a> gg <S-v> G
au BufNewFile,BufRead *.phn set filetype=clojure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment