-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
256 lines (183 loc) · 6.94 KB
/
Copy pathvimrc
File metadata and controls
256 lines (183 loc) · 6.94 KB
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
"colorscheme desert
filetype off " determines the type of the current file
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'kien/ctrlp.vim'
Plugin 'mileszs/ack.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'mattn/emmet-vim'
Plugin 'godlygeek/tabular'
Plugin 'kokx/exuberant-ctags'
Plugin 'vim-airline/vim-airline'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
call vundle#end() " required
filetype plugin indent on " required
colorscheme solarized
if ! has('gui_running')
set t_Co=256
let g:solarized_termcolors=256
endif
let Tlist_Ctags_Cmd='/usr/local/bin/ctags' " tell taglist where to find ctags
let Tlist_Show_One_File = 1 " Only show tags for current buffer
function PhpCheck()
let syntaxCheck = system("php -l " . bufname("%"))
if syntaxCheck !~ "No syntax error"
echom syntaxCheck
return
endif
endfunction
autocmd BufWritePost *.php call PhpCheck()
" PHP syntax checking
map <D-F12> :!php -l %<CR>
" toggle the NERDTree
map <D-F2> :NERDTreeToggle<CR>
" toggle the NERDTree
map <D-F3> :NERDTreeFind<CR>
" toggle the taglist
map <D-F4> :TlistToggle<CR>
" source current file (e.g. to load new vimrc configuration)
map <C-S> :so %<CR>
" disable the arrow keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
inoremap jj $
inoremap jk <Esc>
" use the arrow keys to move between split windows
nnoremap <silent> <right> <c-w>l
nnoremap <silent> <left> <c-w>h
nnoremap <silent> <up> <c-w>k
nnoremap <silent> <down> <c-w>j
nnoremap <silent> <d-down> <c-w>-
nnoremap <silent> <d-up> <c-w>+
nnoremap <silent> <d-left> <c-w><
nnoremap <silent> <d-right> <c-w>>
" map Z to ~ to compensate for ~'s position in the new mac's keyboard
nnoremap Z ~
" disable the F1 help screen
"nmap <F1> <nop>
"nmap <c-l> !open [http://www.php.net/<cword> http://www.php.net/<cword>]
" with the cursor on foo it outputs:
" console.log('foo');
" console.log(foo);
nmap <c-c> V10<iconsole.log(jkA);jkyypkf(a'jkf)i'jk
" with the cursor on foo it outputs:
" error_log('foo');
" error_log(foo);
nmap <c-e>1 V10<ierror_log(jkA);jkyypkf(a'jkf)i'jk
" with the cursor on foo it outputs:
" error_log('foo');
" error_log(str_replace(array('\n', '\t'), ' ', foo));
nmap <c-e>2 V10<ierror_log(jkA);jkyypwastr_replace(array("\n", "\t"), ' ', jkea)jkkF(a'jkea'jk
" with the cursor on foo it outputs:
" error_log('foo');
" error_log(json_encode(foo, true));
nmap <c-e>3 V10<ierror_log(jkA);jkyypwajson_encode(jkf)i)jkkF(a'jkf)i'jk
nmap - $
nmap <Space> <PageDown>
nmap <BS> <PageUp>
" use double ESC to switch to Normal mode when in :term
tnoremap <ESC><ESC> <C-\><C-N>
nmap <c-b> :CtrlPBuffer<CR>
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
set listchars=tab:▸\ ,eol:¬,space:.
"Invisible character colors
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
highlight Space guifg=#4a4a59
set autoindent " set the cursor at same indent as line above
set autoread " watch for file changes
set background=dark
set bs=2 " backspacing over everything in insert mode
" Change the 'completeopt' option so that Vim's popup menu doesn't select the
" first completion item, but rather just inserts the longest common text of
" all matches; and the menu will come up even if there's only one match. (The
" longest setting is responsible for the former effect and the menuone is
" responsible for the latter.)
" NOT WORKING (why ???)
"set completeopt=longest,menuone
set colorcolumn=80 " set the 80 characters soft line limit
set copyindent " use existing indents for new indents
set dir=~/tmp " use this directory to save the swp files
set encoding=utf-8
set expandtab " expand <Tab>s with spaces; death to tabs!
set foldmethod=marker " Folding Stuff
set hidden " Hide buffers when they are abandoned
set history=100 " keep 100 lines of history
set hlsearch " highlight the last searched term
set incsearch " incremental search
set ignorecase " search ignoring case
set laststatus=2 " always show the statusline
set matchtime=5 " blink matching chars for .x seconds
set modelines=0 " disable modeline parsing (vulnerability)
set nocompatible " Use Vim defaults
set noerrorbells " No error bells please
set number " display the line numbers
set preserveindent " save as much indent structure as possible
set ruler " show the cursor position
set scrolloff=5 " keep at least 5 lines around the cursor
set shiftround " always round indents to multiple of shiftwidth
set shiftwidth=4
set showcmd " This shows what you are typing as a command
set showmatch " show matching bracket
set smartcase " if the search terms have at least one uppercase letter, the search will become case-sensitive
set smarttab
set softtabstop=4
set tabstop=4
set viminfo='20,\"200 " keep a .viminfo file
syntax on " syntax highlighting
" which tags files to load
set tags=tags;/
" Auto-detect some files as HTML files
augroup filetypedetect
au BufRead,BufNewFile *.blade set filetype=php
au BufRead,BufNewFile *.twig set filetype=php
au BufRead,BufNewFile *.vue set filetype=html
au BufRead,BufNewFile *.vue set filetype=html
augroup END
"Automatically source the Vimrc file on save.
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
" tell ctrl-p to ignore some directories
let g:ctrlp_custom_ignore = '\v[\/](build|cache|dist|node_modules|target|vendor)|(\.(git|ico|idea|svn|swp))$'
set guifont=Monaco\ for\ Powerline:h14
let g:airline_powerline_fonts = 1
let g:Powerline_symbols='unicode'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''