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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
" Author: Florian "Bluewind" Pritz <flo@xssn.at>
" misc settings {{{
set nocompatible
set encoding=utf-8 " unicode encoding
if &term =~# '^\(screen\|rxvt*\)$' "tty blinks otherwise
set t_Co=256
endif
set nobackup
set noexpandtab
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set ruler " show me where the cursor is
set rulerformat=%l/%L(%p%%),%c " a better ruler
set showmatch " show matching brackets
set number " show line numbers
set showmode " show mode at bottom of screen
set hlsearch " highlight all search results
set incsearch " increment search
set ignorecase " case-insensitive search
set smartcase " upper-case sensitive search
set nowrapscan " stop searching at EOF
set laststatus=2
set mouse=a
set nopaste
set foldmethod=marker
set scrolloff=3
set showcmd
set display=uhex
set listchars=trail:·,precedes:«,extends:»,tab:▸\ ,eol:↲
set hidden
set display+=lastline
if exists("+undofile")
set undofile
if isdirectory($HOME . '/.vim/undo') == 0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=~/.vim/undo//
set undodir+=.
endif
set splitbelow
set splitright
set wildmenu
set wildmode=full
set wildignore=*.o,*.a,*.class,*.mo,*.la,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc,*~,.git,.svn,.hg,
set completeopt-=preview
set complete+=k " enable dictionary completion
set completeopt=menuone,menu,longest
let mapleader = ","
let maplocalleader = "\\"
let g:sudo_no_gui = 1
let g:ycm_extra_conf_globlist = ['~/.ycm_extra_conf.py']
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
let g:tex_flavor='latex'
let g:tagbar_phpctags_bin='~/git/phpctags/bin/phpctags'
let g:tagbar_phpctags_memory_limit = '512M'
"let g:ale_completion_enabled = 1
let g:ale_lint_delay = 2000
" }}}
filetype off
set runtimepath+=/usr/share/vim
set runtimepath+=~/.vim/bundle/vundle
call vundle#begin()
"Plugin 'Valloric/YouCompleteMe'
Plugin 'SirVer/ultisnips'
"Plugin 'scrooloose/syntastic'
"Plugin 'neomake/neomake'
Plugin 'honza/vim-snippets'
Plugin 'Shougo/unite.vim'
Plugin 'Shougo/vimproc.vim'
Plugin 'Shougo/vimshell.vim'
Plugin 'Shougo/neoyank.vim'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'airblade/vim-gitgutter'
Plugin 'SudoEdit'
Plugin 'rking/ag.vim'
Plugin 'Chun-Yang/vim-action-ag'
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'adoy/vim-php-refactoring-toolbox'
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'sirtaj/vim-openscad'
Plugin 'sjl/splice.vim'
"Plugin 'LaTeX-Box-Team/LaTeX-Box'
Plugin 'lervag/vimtex'
Plugin 'chase/vim-ansible-yaml'
Plugin 'vim-php/tagbar-phpctags.vim'
Plugin 'joonty/vim-phpqa.git'
Plugin 'jamessan/vim-gnupg'
Plugin 'davewongillies/vim-eyaml'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'thaerkh/vim-workspace'
Plugin 'rhysd/vim-grammarous'
Plugin 'dbeniamine/vim-mail'
Plugin 'vim-ruby/vim-ruby'
Plugin 'w0rp/ale'
Plugin 'rodjek/vim-puppet'
Plugin 'simnalamburt/vim-mundo'
call vundle#end()
syntax on
filetype plugin indent on
" functions {{{
function! Filebin(start, end)
let range = expand(a:start) . "," . expand(a:end)
silent exe expand(range) . "w !fb -n " . expand("%:t") . " -e " . expand(&ft)
redraw!
endfunction
" Get the current line number & file name, view the git commit that inserted it
fun! BlameCurrentLine()
let lnum = line(".")
let file = @%
exec "!gitBlameFromLineNo " lnum file
endfun
" }}}
"aliases and commands {{{
cnorea w!! w !sudo tee "%" > /dev/null
" decode quoted printable encoding
cnorea qpd %!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;'
command! -nargs=0 -range=% Fb :call Filebin(<line1>, <line2>)
command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
" }}}
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" mappings {{{
" common save shortcuts
inoremap <C-s> <esc>:w<cr>a
nnoremap <C-s> :w<cr>
inoremap <C-c> <esc>:q<cr>
nnoremap <C-c> :q<cr>
noremap <C-h> :nohl<CR>
inoremap <C-h> <ESC>:nohl<CR>a
" fix some keycodes
set <C-Right>=[C
set <C-Left>=[D
" unsupported options
"set <C-Up>=[A
"set <C-Down>=[B
" movement mappings for splits
nnoremap <silent> <C-Right> <c-w>l
nnoremap <silent> <C-Left> <c-w>h
nnoremap <silent> <C-Up> <c-w>k
nnoremap <silent> <ESC>[A <c-w>k
nnoremap <silent> <C-Down> <c-w>j
nnoremap <silent> <ESC>[B <c-w>j
nnoremap <silent> <C-W><C-Right> <c-w>L
nnoremap <silent> <C-W><C-Left> <c-w>H
nnoremap <silent> <C-W><C-Up> <c-w>K
nnoremap <silent> <C-W><C-Down> <c-w>J
nnoremap <silent> <C-W>[A <c-w>K
nnoremap <silent> <C-W>[B <c-w>J
nnoremap <silent> <C-W>[1;5C <c-w>L
nnoremap <silent> <C-W>[1;5D <c-w>H
nnoremap <silent> <C-W>[1;5A <c-w>K
nnoremap <silent> <C-W>[1;5B <c-w>J
nnoremap <silent> [1;5C <c-w>l
nnoremap <silent> [1;5D <c-w>h
nnoremap <silent> [1;5A <c-w>k
nnoremap <silent> [1;5B <c-w>j
nnoremap <Up> gk
nnoremap <Down> gj
nnoremap j gj
nnoremap k gk
" " Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" " Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P
" Get the commit responsible for the current line
nmap <c-b> :call BlameCurrentLine()<cr>
nmap <F1> :TagbarToggle<CR>
noremap <F2> :NERDTreeToggle<CR>
inoremap <F2> <ESC>:NERDTreeToggle<CR>
" }}}
let python_highlight_all = 1
let g:tex_comment_nospell=1
" Neomake
"autocmd BufWritePost * Neomake
" Syntastic
let g:syntastic_enable_perl_checker = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
autocmd BufRead,BufNewFile PKGBUILD let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_perl_perlcritic_post_args = '--verbose "\%s:\%f:\%l:\%c: \%p: \%m\n"'
" Ultisnips
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsListSnippets="<c-l>"
let g:UltiSnipsUsePythonVersion=2
let g:UltiSnipsEditSplit="vertical"
let g:ulti_expand_or_jump_res = 0 "default value, just set once
function! Ulti_ExpandOrJump_and_getRes()
call UltiSnips#ExpandSnippetOrJump()
return g:ulti_expand_or_jump_res
endfunction
let g:snips_author = 'Florian Pritz <bluewind@xinu.at>'
" tagbar
let g:tagbar_left=1
let g:tagbar_autofocus=1
let g:tagbar_autoclose=1
" syntastic
let g:syntastic_check_on_open = 1
" phpqa
let g:phpqa_messdetector_autorun = 0
let g:phpqa_codesniffer_autorun = 0
let g:phpqa_codecoverage_autorun = 0
let g:phpqa_codecoverage_file = "code-coverage-report.xml"
" vim-grammarous
let g:grammarous#languagetool_cmd = 'languagetool'
let g:grammarous#show_first_error = 1
let g:grammarous#hooks = {}
function! g:grammarous#hooks.on_check(errs) abort
nmap <buffer><C-n> <Plug>(grammarous-move-to-next-error)
nmap <buffer><C-p> <Plug>(grammarous-move-to-previous-error)
endfunction
function! g:grammarous#hooks.on_reset(errs) abort
nunmap <buffer><C-n>
nunmap <buffer><C-p>
endfunction
" vim-mail
let g:VimMailContactsProvider='khard'
let g:VimMailSpellLangs=['en', 'de']
let g:VimMailFromList = [
\'Florian Pritz <florian@server-speed.net>',
\'Florian Pritz <bluewind@archlinux.org>',
\'Florian Pritz <bluewind@xinu.at>'
\]
let g:VimMailDoNotFold=1
" unite
let g:unite_source_history_yank_enable = 1
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
let g:unite_source_rec_max_cache_files=5000
call unite#custom#profile('default', 'context',
\ { 'prompt': '➤ ',
\ 'start_insert' : '1'})
call unite#sources#rec#define()
call unite#custom#source('file_rec/async,file_mru,file,buffer,grep', 'ignore_pattern', 'blib/\|\.build/\|cover_db/\|.undodir/\|vendor/')
call unite#custom#source('file_rec,file_rec/async', 'max_candidates', 0)
function! s:unite_settings()
let b:SuperTabDisabled=1
inoremap <silent> <buffer><expr> <Leader>v unite#do_action('right')
inoremap <silent> <buffer><expr> <Leader>s unite#do_action('below')
inoremap <silent> <buffer> <c-e> <end>
inoremap <silent> <buffer> <c-a> <home>
imap <silent> <buffer> <tab> <plug>(unite_complete)
endfunction
" vim-workspace
"let g:workspace_autosave_always = 1
let g:workspace_autosave_untrailspaces = 0
let g:workspace_autosave_ignore = ['gitcommit']
let g:workspace_session_disable_on_args = 1
nnoremap <leader>ss :ToggleWorkspace<CR>
" Custom mappings for the unite buffer
autocmd FileType unite call s:unite_settings()
nnoremap <leader>w :<C-u>Unite -buffer-name=files -start-insert file<cr>
nnoremap <leader>qq :<C-u>Unite -buffer-name=files -start-insert file_rec/async:!<cr>
nnoremap <leader>yu :<C-u>Unite -buffer-name=yank history/yank<cr>
nnoremap <leader>b :<C-u>Unite -buffer-name=buffer buffer<cr>
" neoyank
let g:neoyank#file = $HOME.'/.vim/yankring.txt'
" completion
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
" automatic folding
autocmd FileType php set foldmethod=syntax
autocmd FileType php set foldlevelstart=2 foldnestmax=2
autocmd FileType php let g:php_folding=1
autocmd FileType python set foldmethod=indent
autocmd FileType python set foldlevelstart=2 foldnestmax=2
autocmd FileType python set ts=4 sw=4 softtabstop=4 et
autocmd FileType yaml set ts=2 sw=2 softtabstop=2 et
" misc autocmd settings
autocmd FileType make setlocal noexpandtab
autocmd FileType text setlocal textwidth=78
autocmd FileType tex setlocal linebreak spell
autocmd FileType mail setlocal linebreak spell | inoremap <enter> <C-R>=(Ulti_ExpandOrJump_and_getRes() == 1)?"":"\n"<CR>
autocmd BufRead,BufNewFile PKGBUILD let is_bash=1 | set ft=sh
autocmd FileType cucumber setlocal expandtab
" move to first line in git commits
autocmd FileType gitcommit autocmd! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" colorscheme
let g:jellybeans_background_color_256 = 'none'
let g:jellybeans_background_color = '000000'
let g:jellybeans_overrides = {
\ 'SpecialKey': { 'guifg': 'b0b0b0', 'guibg': '000000'}
\}
"colorscheme jellybeans
colorscheme monokai
hi DiffAdd ctermfg=231 ctermbg=64 cterm=bold guifg=#f8f8f2 guibg=#46830c gui=NONE
hi DiffDelete ctermfg=88 ctermbg=52 cterm=NONE guifg=#8b0807 guibg=#5F0000 gui=NONE
hi DiffChange ctermfg=NONE ctermbg=17 cterm=NONE guifg=#f8f8f2 guibg=#243955 gui=NONE
hi DiffText ctermfg=231 ctermbg=26 cterm=bold guifg=#f8f8f2 guibg=#005FD7 gui=NONE
hi SpellCap ctermbg=17
" highlight extra whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
" hide passwords
autocmd BufReadCmd,FileReadCmd passwords.gpg set ft=gpgpass
autocmd Syntax yaml syn match MyPassword /\%(^\s*pass\(word\)\?:\s*\)\@<=\S\+/ conceal cchar=*
autocmd Syntax gpgpass syn match GpgPassword /\%(^\)\@<=\S\+/ conceal cchar=*
autocmd Syntax gpgpass syn match GpgPasswordQuoted /\%(^\)\@<=".\+"/ conceal cchar=*
set conceallevel=2 concealcursor=nvc
let g:tex_conceal = ""
if has("gui_running")
set guifont=Dejavu\ Sans\ Mono\ 10
set guioptions=aegi
set lines=80 columns=180
endif
|