-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdotvimrc
657 lines (520 loc) · 18.1 KB
/
dotvimrc
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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
" camron flanders // macvim
" last update: 05.18.2016:CBF
" this is my primary, day-to-day, preferred .vimrc tuned for macvim.
" I do not publish any of my other .vimrcs which I use for windows gvim
" or *nix terminals.
" feel free to use all or part of my vimrc to learn, modify, use. If used in
" a .vimrc you intend to distribute, please credit appropriately.
set nocompatible "screw vi, vim's better
"git-plug configuration {{{
" Load vim-plug automatically, even if it's not installed
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
" plug-ins list {{{
call plug#begin('~/.vim/bundle')
"Plug 'Shougo/neoyank.vim'
"Plug 'Shougo/unite.vim'
"Plug 'airblade/vim-gitgutter'
"Plug 'flowtype/vim-flow'
"Plug 'kien/rainbow_parentheses.vim'
"Plug 'ryanoasis/vim-devicons'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'Raimondi/delimitMate'
Plug 'Shougo/vimproc.vim'
Plug 'Valloric/YouCompleteMe'
Plug 'joonty/vdebug'
Plug 'stephpy/vim-php-cs-fixer'
Plug '2072/vim-syntax-for-PHP'
Plug 'AndrewRadev/switch.vim'
Plug 'SirVer/ultisnips'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'docunext/closetag.vim'
Plug 'easymotion/vim-easymotion'
Plug 'godlygeek/tabular'
Plug 'honza/vim-snippets'
Plug 'joonty/vim-phpunitqf'
Plug 'majutsushi/tagbar'
Plug 'mattn/emmet-vim'
Plug 'mhinz/vim-signify'
Plug 'mkusher/padawan.vim'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'ntpeters/vim-better-whitespace'
Plug 'rhysd/conflict-marker.vim'
Plug 'rking/ag.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/syntastic'
Plug 'sheerun/vim-polyglot'
Plug 'sjl/gundo.vim'
Plug 'skammer/vim-css-color'
Plug 'ternjs/tern_for_vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-characterize'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-speeddating'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'vim-ctrlspace/vim-ctrlspace'
Plug 'vim-php/tagbar-phpctags.vim'
Plug 'vim-scripts/LargeFile'
Plug 'vim-scripts/SQLUtilities'
Plug 'vim-scripts/SQLComplete.vim'
Plug 'vim-scripts/Align'
Plug 'vim-scripts/YankRing.vim'
Plug 'vim-scripts/vcscommand.vim'
Plug 'wellle/targets.vim'
" syntax/language files
Plug 'StanAngeloff/php.vim'
Plug 'chrisbra/csv.vim'
Plug 'mxw/vim-jsx'
Plug 'pangloss/vim-javascript'
Plug 'plasticboy/vim-markdown'
Plug 'tpope/vim-haml'
" color themes
Plug 'altercation/vim-colors-solarized'
Plug 'tomasr/molokai'
Plug 'nanotech/jellybeans.vim'
Plug 'w0ng/vim-hybrid'
"Plug 'Konstruktionist/vim'
"Plug 'trusktr/seti.vim'
Plug 'MaxSt/FlatColor'
Plug 'benjaminwhite/Benokai'
Plug 'chriskempson/tomorrow-theme', {'rtp': 'vim'}
Plug 'marciomazza/vim-brogrammer-theme'
Plug 'mswift42/vim-themes'
Plug 'petelewis/vim-evolution'
Plug 'toupeira/vim-desertink'
Plug 'tpope/vim-vividchalk'
Plug 'trevorrjohn/vim-obsidian'
Plug 'notpratheek/vim-luna'
Plug 'mhartington/oceanic-next'
Plug 'GertjanReynaert/cobalt2-vim-theme'
call plug#end()
"}}}
"}}}
if &t_Co > 2
syntax on
endif
if &t_Co >= 256 || has("gui_running")
set background=dark
colorscheme brogrammer
endif
if has("gui_running")
set macligatures
endif
let mapleader = "\<Space>" "set leader to spacebar
set relativenumber "line numbers show current line and relative offsets
set number
"set cursorline "highlight the current line
" only highlight the cursorline in the active window
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
let g:gitgutter_max_signs=500 "limit how many signs gitgutter calculates, so it doesn't get _too_ slow
"startup settings {{{
"source a few files {{{
"source macros/matchit.vim
"}}}
"backup/swp settings {{{
set nobackup
set noswapfile
set noundofile
"}}}
"file type settings, on {{{
filetype on
filetype plugin on "turn on filetype based plugins
"filetype indent is also on, in the next section.
"}}}
"}}}
"indention stuff {{{
filetype indent on "indent based on filetype
"set autoindent "indent, duh
"set smartindent "we'll autoindent (with intelligence), bitches
"set cin "auto c-indenting
set shiftround "round to a multiple of my tab settings
"}}}
"completion settings {{{
set complete+=k "built in plus my defined, below
set showfulltag "show me args for tag
set tags=./tags,tags,~/.vimtags;
"set tags for filetype {{{
autocmd FileType python
\ set tags+=$HOME/.vim/tags/python.ctags;
autocmd FileType javascript
\ set tags+=$HOME/work/scripts/generic_functions/common/tags; |
\ set tags+=$HOME/work/scripts/generic_functions/6.x/tags; |
\ set tags+=$HOME/work/scripts/generic_functions/5.x/tags;
"}}}
"}}}
"stuff {{{
let xml_use_xhtml = 1 "close html as xhtml, properly.
set encoding=utf-8
set scrolloff=3
set nowrap
set hidden "let me have hidden buffers
set showmatch "show me where the matching bracket is
set ttyfast
set ruler "show me the ruler!
set rulerformat=%35(%5l,%-6(%c%V%)\ %5L\ %P%) "my ruler shows: line/vColumn/total/pos
"set guifont=InputMono\ ExLight:h13 "use guifont=* to open font picker
set guifont=Hasklig\ Light:h14 "use guifont=* to open font picker
set history=1000 "keep last 1000 commands
set undolevels=1000 "use many muchos levels of undo
set sc "show commands as I type
set anti "make text pretty
set visualbell "a quiet vim is a happy vim
set backspace=indent,eol,start "allow backspacing over everything
set modeline
"set transparency=8 "for MacVim only... term sessions are already transparent
set shortmess=atITA "I don't want long messages
set nostartofline "keep my cursor where it was
set fen "let me fold things
set foldmethod=indent "and fold on indents
set foldlevelstart=99
set foldnestmax=10 "10 nested fold max
set lazyredraw "don't update the screen during macros
set list "show chars
set listchars=tab:▸\ ,trail:·,extends:»,nbsp:· "how to show chars
nnoremap <leader>z za
"}}}
"wildmenu {{{
set wildmenu "go wild!
set wildmode=list:longest,full "tame the wildness, using unix-style match
set wildignore=*.o,*.obj,*.bak,*.exe,*.pyc,*.DS_Store,*.db "don't show me crap I don't want
set completeopt=menu,menuone
"}}}
"gui options {{{
if has('gui_running')
set guitablabel=%t "tabs display file name
"kick it old school, no gui needed.
set guioptions-=T "kill toolbar
set guioptions-=m "kill menu
set guioptions-=r "kill right scrollbar
set guioptions-=l "kill left scrollbar
set guioptions-=L "kill left scrollbar with multiple buffers
endif
"}}}
"cursor options {{{
set gcr=a:blinkwait500-blinkon1000-blinkoff150 "tune the blinking of the cursor
set gcr=i:hor10 "underline cursor. not too thick not too thin. goldielocks style
set gcr=v:block "selecting should cover the text
"}}}
"tab stuff {{{
set expandtab "expand tabs to spaces, when not an indent
set smarttab "let's be smart about our tabs
set shiftwidth=4 "make tabs 4 spaces
set softtabstop=4 "softtab value, 4 spaces
set tabstop=4 "keep default for softtab compat.
"}}}
"search / diff {{{
set hlsearch "highlight what I find
set incsearch "show matches as I type
set ignorecase smartcase "ignore case unless I type in multi-case
set laststatus=2
"}}}
"plugin settings {{{
"multi cursor
"let g:multi_cursor_start_key='<C-m>'
"syntastic settings {{{
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
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
"let g:syntastic_javascript_checkers = ['flow']
let g:syntastic_scss_checkers = ['sassc']
let g:syntastic_php_checkers = ['php']
"}}}
"airline {{{
let g:airline_powerline_fonts = 1
let g:airline#extensions#tagbar#enabled = 1
let g:airline#extensions#csv#enabled = 1
let g:airline_theme='jellybeans'
function! AirlineInit()
let g:airline_section_z = '%3p%% %{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#/%L:%3v'
endfunction
let g:airline#extensions#default#section_truncate_width = {
\ 'a': 79,
\ 'b': 100,
\ 'x': 88,
\ 'y': 88,
\ 'z': 45,
\ 'warning': 90,
\ 'error': 90,
\ }
autocmd VimEnter * call AirlineInit()
"}}}
"YankRing {{{
let g:yankring_history_dir = "~/temp, /tmp, ~/.vim-temp"
"}}}
let g:jsx_ext_required = 0
"}}}
"VDebug {{{
if !exists('g:vdebug_options')
let g:vdebug_options = {}
endif
let g:vdebug_options["port"] = 9100
let g:vdebug_options["break_on_open"] = 0
let g:vdebug_options["watch_window_height"]=45
let g:vdebug_options["status_window_height"]=5
" let g:vdebug_options["continuous_mode"]=1
"}}}
"Ultisnips {{{
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"}}}
"YCM {{{
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_autoclose_preview_window_after_completion = 1
if !exists('g:ycm_semantic_triggers')
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers.php = ['->', '::', '(', 'use ', 'namespace ', '\']
"}}}
"Padawan {{{
let g:padawan#composer_command = "php /usr/local/bin/composer"
"}}}
"Undo Tree {{{
nnoremap <leader>u :GundoToggle<CR>
let g:gundo_right = 1
"}}}
"Explore map & settings {{{
nnoremap <leader>e :Ex<CR>
let g:netrw_liststyle=3
"}}}
"TagBar {{{
nnoremap <leader>t :TagbarToggle<CR>
""}}}
"PHP CS Fixer {{{
let g:php_cs_fixer_level = "symfony"
""}}}
"NERDCommenter {{{
let NERDShutUp = 1 "don't complain to me
map <leader>cc <plug>NERDCommenterToggle
"}}}
" ctrl space options {{{
"let g:CtrlSpaceSymbols = { "Vis": "ϟ"}
nnoremap <silent><leader>f :CtrlSpace O<cr>
nnoremap <silent><leader>b :CtrlSpace H<cr>
" Use ag for search
if executable('ag')
let g:CtrlSpaceGlobCommand = 'ag -l --nocolor -g ""'
endif
"}}}
"Gist options {{{
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:github_user = "camflan"
let g:github_token = "897b6a6109e0de41cdb13f391ba62ea2"
"}}}
"}}}
"omnicomplete setup {{{
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
"autocmd FileType php set omnifunc=phpcomplete#CompletePHP
"autocmd BufNewFile,BufRead *.scss set ft=scss.css
nnoremap <leader>g :AgBuffer
"}}}
"abbreviations {{{
" Correct Typos {{{
" English {{{
iab beacuse because
iab becuase because
iab acn can
iab cna can
iab centre center
iab chnage change
iab chnages changes
iab chnaged changed
iab chnagelog changelog
iab Chnage Change
iab Chnages Changes
iab ChnageLog ChangeLog
iab debain debian
iab Debain Debian
iab defualt default
iab Defualt Default
iab differnt different
iab diffrent different
iab emial email
iab Emial Email
iab figth fight
iab figther fighter
iab fro for
iab fucntion function
iab ahve have
iab homepgae homepage
iab logifle logfile
iab lokk look
iab lokking looking
iab mial mail
iab Mial Mail
iab miantainer maintainer
iab amke make
iab mroe more
iab nwe new
iab recieve receive
iab recieved received
iab erturn return
iab retrun return
iab retunr return
iab seperate separate
iab shoudl should
iab soem some
iab taht that
iab thta that
iab teh the
iab tehy they
iab truely truly
iab waht what
iab wiht with
iab whic which
iab whihc which
iab yuo you
iab databse database
iab versnio version
iab obnsolete obsolete
iab flase false
iab recrusive recursive
iab Recrusive Recursive
"}}}
" Days of week {{{
iab monday Monday
iab tuesday Tuesday
iab wednesday Wednesday
iab thursday Thursday
iab friday Friday
iab saturday Saturday
iab sunday Sunday
"}}}
"}}}
"}}}
"key mappings {{{
"unmaps {{{
"}}}
"plugin mappings {{{
"}}}
".vimrc editing maps {{{
"makes it easy to edit/reload vimrc for tweaks. I like to tweak.
:nmap <leader>s :so $MYVIMRC<CR>
:nmap <leader>v :vsp $MYVIMRC<CR>
"}}}
"mappings to swap 2 words {{{
" Swap word with next word
nmap <silent> gw "_yiw:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<cr>
"}}}
"newlines while typing {{{
" here are some commands for new lines, quickly while in insert mode
"imap <D-CR> <Esc>o
"imap <D-S-CR> <Esc>A;<CR>
"imap <D-S-A> <Esc>A:<CR>
"}}}
"buffer navigation nmaps {{{
map <C-h> <C-W>h
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-l> <C-W>l
"}}}
"general maps {{{
"make vim use correct regexes
nnoremap / /\v
vnoremap / /\v
nnoremap <leader>l :set list!<cr>
" Speed up scrolling of the viewport slightly
nnoremap <C-e> 2<C-e>
nnoremap <C-y> 2<C-y>
"changes :command to ;command making it faster
nnoremap ; :
vnoremap ; :
"make this the way it should work by default
noremap Y y$
"toggle wrap
nmap <leader>w :set nowrap!<CR>
"when wrapping, wrap text to the correct indentation
set breakindent
set showbreak=↪
" make jj esc, in insert mode.
inoremap jj <C-[>
" disable esc key to stop using it
inoremap <esc> <nop>
" easily, temporarily disable search highlighting"
nmap <silent> <leader>n :silent :nohlsearch<CR>
" sudo write to files that weren't opened with sudo originally!
cmap w!! w !sudo tee % >/dev/null
"}}}
"expansions {{{
"file directory
imap <leader>fd <C-R>=expand("%:p:h")<CR>
" present working dir
imap <leader>pwd <C-R>=getcwd()<CR>
"}}}
"}}}
"functions {{{
"python refactoring method {{{
function! PythonExtractMethod() range
let name = inputdialog("Name of new method: ")
let args = inputdialog("Argument list: ")
'<
exe "normal O\<cr>def " . name ."(" . args . "):\<esc>"
'>
exe "normal o#return \<cr>\<esc>"
normal >'<
endfunction
"}}}
"insert/swap iScript debug statements {{{
function! Logging(level)
let base_string = 'debug.log("' . a:level . '", "'
let curr_line = getline('.')
let match = match(curr_line, "debug")
if match == -1
execute "normal i" . base_string
else
for this_level in ['CRITICAL', 'ERROR', 'WARNING', 'NOTIFY', 'INFO', 'DEBUG']
let new_string = substitute(curr_line, '"' . this_level . '"', '"' . a:level . '"', "")
if new_string != curr_line
execute "normal ddO" . new_string
break
endif
endfor
endif
endfunction
"}}}
" Refactor function to easily find/replace a dictionary of words with new words {{{
" Refactor the given lines using a dictionary
" replacing all occurences of each key in the dictionary with its value
function! Refactor(dict) range
execute a:firstline . ',' . a:lastline . 's/\C\<\%(' . join(keys(a:dict),'\|'). '\)\>/\='.string(a:dict).'[submatch(0)]/ge'
endfunction
command! -range=% -nargs=1 Refactor :<line1>,<line2>call Refactor(<args>)
"}}}
"iScript imaps {{{
"these will input the beginning of a debug.log statement for iScriptDebug
imap \dc <Esc>:call Logging("CRITICAL")<CR>a
imap \de <Esc>:call Logging("ERROR")<CR>a
imap \dw <Esc>:call Logging("WARNING")<CR>a
imap \dn <Esc>:call Logging("NOTIFY")<CR>a
imap \di <Esc>:call Logging("INFO")<CR>a
imap \dd <Esc>:call Logging("DEBUG")<CR>a
"this will swap the current debug level for a new one
nmap \dc :call Logging("CRITICAL")<CR>
nmap \de :call Logging("ERROR")<CR>
nmap \dw :call Logging("WARNING")<CR>
nmap \dn :call Logging("NOTIFY")<CR>
nmap \di :call Logging("INFO")<CR>
nmap \dd :call Logging("DEBUG")<CR>
"}}}
let $PATH=$PATH . ':' . expand('~/.composer/vendor/bin')
" vim:foldmethod=marker:foldlevel=1:ft=vim: