-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
188 lines (166 loc) · 5.08 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
set nocompatible
set t_Co=256
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" This is the Vundle package, which can be found on GitHub.
" For GitHub repos, you specify plugins using the
" 'user/repository' format
Plugin 'gmarik/Vundle.vim'
" Nerdtree
Plugin 'scrooloose/nerdtree'
" vim-airline
Plugin 'bling/vim-airline'
"colour-scheme
Plugin 'ajh17/Spacegray.vim'
" Markdown
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
" Fugitive
Plugin 'tpope/vim-fugitive'
" VMustache
Plugin 'tobyS/vmustache'
" Ultisnips
Plugin 'SirVer/ultisnips'
" PDV
Bundle 'tobyS/PDV'
" Ctrlp
Plugin 'kien/ctrlp.vim'
" Commentary
Plugin 'tpope/vim-commentary'
" Easymotion
Plugin 'Lokaltog/vim-easymotion'
" Surround
Plugin 'tpope/vim-surround'
" Gundo
Plugin 'sjl/gundo.vim'
" PHP
Plugin 'StanAngeloff/php.vim'
" PHP QA Tools
Bundle 'joonty/vim-phpqa.git'
" Supertab
Plugin 'ervandew/supertab'
" PHP refactoring
Bundle 'vim-php/vim-php-refactoring'
" Blade syntax
Plugin 'xsbeats/vim-blade'
" PHP-complete
Bundle 'Shougo/vimproc'
Bundle 'Shougo/unite.vim'
Bundle 'm2mdas/phpcomplete-extended'
Bundle 'm2mdas/phpcomplete-extended-laravel'
" All plugins must be defined before here
call vundle#end()
filetype plugin indent on
" NERDTree
map <C-e> :NERDTreeToggle<CR>
let NERDTreeShowHidden=0 " Press I to toggle hidden files
let NERDTreeQuitOnOpen=1
let NERDTreeDirArrows=1
let NERDTreeChDirMode=2
let NERDTreeHighlightCursorline=1
autocmd StdinReadPre * let s:std_in=1 " Open NerdTree on launch if no file selected
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " Close vim if only NerdTree open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " Close vim if only NerdTree open
" vim-airline
set encoding=utf-8
set guifont=Meslo\ LG\ M\ for\ Powerline "Install the font on host Putty 'powerline/fonts'
let g:airline#extensions#tabline#enabled=1
let g:airline_powerline_fonts = 1
set term=xterm-256color
set laststatus=2 " Always show the status bar
set showtabline=2
set noshowmode "Hide the default mode text
"UltiSnips
let g:UltiSnipsExpandTrigger="<Leader>sn"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" PHP Documentor
inoremap <leader>db <ESC>:call pdv#DocumentWithSnip()<CR>i
nnoremap <leader>db :call pdv#DocumentWithSnip()<CR>
vnoremap <leader>db :call pdv#DocumentWithSnip()<CR>
let g:pdv_template_dir = $HOME ."/.vim/DocBlocks/"
" PHP QA
let g:phpqa_messdetector_autorun = 1
let g:phpqa_codesniffer_args = "--standard=~/.vim/rulesets/phpcs.xml"
let g:phpqa_messdetector_ruleset = "~/.vim/rulesets/phpmd.xml"
" Quick fix window
au FileType qf call MoveAndResize()
function MoveAndResize()
wincmd L
vertical res 45
endfunction
nmap <Leader>ec :lcl<CR>
nmap <Leader>en :lne<CR>
imap <Leader>en <ESC>:lne<CR>i
vmap <Leader>en <ESC>:lne<CR>i
nmap <Leader>ep :lp<CR>
imap <Leader>ep <ESC>:lp<CR>i
vmap <Leader>ep <ESC>:lp<CR>
"CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*.swp,*.zip,*.so,*/tmp/*
" Gundo
nnoremap <F5> :GundoToggle<CR>
let g:gundo_close_on_revert = 1
set hidden " stops undo history deleting after buffer change
" Omincomplete
highlight Pmenu ctermbg=238 gui=bold
set completeopt-=preview
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
"PHP complete_extended
autocmd FileType php setlocal omnifunc=phpcomplete_extended#CompletePHP
let g:phpcomplete_index_composer_command="composer"
" Supertab
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
" PHP refactoring
let g:php_refactor_command='php ~/.vim/refactor/refactor.phar'
" keymaps
nmap <C-s> :w<CR> " Make sure to add 'stty ixany' and 'stty ixoff -ixon' to .bashrc to disable freezing
imap <C-s> <ESC>:w<CR>i
nmap vs :vsplit<CR>
nmap sp :split<CR>
nmap <C-d> :bnext<CR> " Faster buffer changes
nmap <C-a> :bprev<CR> " Faster buffer changes
nmap <C-x> :bd<CR> " Close the current buffer"
"Standard Settings"
colorscheme spacegray
set tabstop=4
set shiftwidth=4
set smarttab
set tags=tags
set softtabstop=4
set autoindent
set copyindent
set pastetoggle=<F2>
set expandtab
set shiftround
set backspace=indent,eol,start " allow backspaceing over evetyting in insert mode
set number
set ignorecase
set smartcase
set noerrorbells
set autowrite
" Disable all beeps
set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
" Swap files out of the project root
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
" Syntax highlighting
au BufNewFile,BufRead *.blade.php set filetype=blade " Set blade extension syntax
" Folding
set foldmethod=syntax
let php_folding=1
let javaScript_fold=1
let xml_syntax_folding=1
set foldlevelstart=1
autocmd BufWinLeave *.* mkview " Save folds when quitting
autocmd BufWinEnter *.* silent loadview " Save folds when quitting