-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_vimrc
More file actions
522 lines (415 loc) · 13.9 KB
/
Copy path_vimrc
File metadata and controls
522 lines (415 loc) · 13.9 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
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
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set guifont=Consolas:h12:cANSI:qDRAFT
set guioptions-=T "remove toolbar
syntax enable
set number
set cpoptions+=$
set virtualedit=all
set incsearch
set hlsearch
set ignorecase
set smartcase
set autochdir
set clipboard=unnamed
"set hidden
filetype off " required
"autocmd BufReadPost *.docx :%!pandoc -f docx -t markdown
"autocmd BufWritePost *.docx :!pandoc -f markdown -t docx % > tmp.docx
"au BufNewFile,BufRead *.py
"\ set softtabstop=4
"\ set textwidth=79
"\ set autoindent
"\ set fileformat=unix
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
"Macros
"Completed python codes
let @c = '/last modifiedyypnct:Completed '
"Python Print
let @p = 'oprint('
let @s = 'yi)ysi)"f"i: ", p'
"if using fish shell
set shell=/bin/bash
" set the runtime path to include Vundle and initialize
" For Linux
"set rtp+=~/.vim/bundle/Vundle.vim
" For Windows
set rtp+=C:\Users\Torsho\vimfiles\bundle\Vundle.vim
" Set tabs as spaces
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
"change font quickly
"from https://vi.stackexchange.com/questions/3093/how-can-i-change-the-font-size-in-gvim
if has("unix")
function! FontSizePlus ()
let l:gf_size_whole = matchstr(&guifont, '\( \)\@<=\d\+$')
let l:gf_size_whole = l:gf_size_whole + 1
let l:new_font_size = ' '.l:gf_size_whole
let &guifont = substitute(&guifont, ' \d\+$', l:new_font_size, '')
endfunction
function! FontSizeMinus ()
let l:gf_size_whole = matchstr(&guifont, '\( \)\@<=\d\+$')
let l:gf_size_whole = l:gf_size_whole - 1
let l:new_font_size = ' '.l:gf_size_whole
let &guifont = substitute(&guifont, ' \d\+$', l:new_font_size, '')
endfunction
else
function! FontSizePlus ()
let l:gf_size_whole = matchstr(&guifont, '\(:h\)\@<=\d\+$')
let l:gf_size_whole = l:gf_size_whole + 1
let l:new_font_size = ':h'.l:gf_size_whole
let &guifont = substitute(&guifont, ':h\d\+$', l:new_font_size, '')
endfunction
function! FontSizeMinus ()
let l:gf_size_whole = matchstr(&guifont, '\(:h\)\@<=\d\+$')
let l:gf_size_whole = l:gf_size_whole - 1
let l:new_font_size = ':h'.l:gf_size_whole
let &guifont = substitute(&guifont, ':h\d\+$', l:new_font_size, '')
endfunction
endif
if has("gui_running")
nmap <S-F12> :call FontSizeMinus()<CR>
nmap <F12> :call FontSizePlus()<CR>
endif
"Persistent undo
if has('persistent_undo') "check if your vim version supports it
set undofile "turn on the feature
set undodir=$HOME/.vim/undo "directory where the undo files will be stored
endif
"Make [[ work
"map ]] :call search("^\\(\\w.*\\)\\?{")<CR>
"map [[ :call search("^\\(\\w.*\\)\\?{", "b")<CR>
"map ][ :call search("^}")<CR>
"map [] :call search("^}", "b")<CR>
"matchit
runtime macros/matchit.vim
set wildmenu
set wildmode=list:longest,full
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"Install plugins here
"Plugin 'justinmk/vim-sneak'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
"Plugin 'L9'
" Git plugin not hosted on GitHub
"Plugin 'git://git.wincent.com/command-t.git'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
Plugin 'ascenator/L9', {'name': 'newL9'}
Plugin 'valloric/youcompleteme'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/syntastic'
"Plugin 'easymotion/vim-easymotion'
Plugin 'flazz/vim-colorschemes'
"Plugin 'justinmk/vim-gtfo'
Plugin 'dahu/nexus'
Plugin 'dahu/vim-KWEasy'
"Vim-KWEasy lets you jump to the very character you’ve got your eyeballs on!
Plugin 'qualiabyte/vim-colorstepper'
Plugin 'jiangmiao/auto-pairs'
Plugin 'scrooloose/nerdcommenter'
Plugin 'wikitopian/hardmode'
Plugin 'svermeulen/vim-easyclip.git'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-unimpaired'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-airline/vim-airline'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'yggdroot/indentline'
Plugin 'tpope/vim-abolish'
Plugin 'mileszs/ack.vim'
"Plugin 'albfan/ag.vim'
"Plugin 'thaerkh/vim-workspace'
Plugin 'plasticboy/vim-markdown'
Plugin 'AndrewRadev/switch.vim'
Plugin 'airblade/vim-rooter'
"Plugin 'shougo/neocomplete.vim'
Plugin 'dag/vim-fish'
"Auto close (X)HTML tags
Plugin 'alvan/vim-closetag'
Plugin 'will133/vim-dirdiff'
"Plugin 'python-mode/python-mode'
"Plugin 'fs111/pydoc.vim' "Should be installed in ftpplugin
Plugin 'tell-k/vim-autopep8'
"Plugin 'ap/vim-css-color'
Plugin 'chrisbra/Colorizer'
Plugin 'xolox/vim-misc'
"Plugin 'xolox/vim-easytags'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'tpope/vim-speeddating'
Plugin 'sagarrakshe/toggle-bool'
Plugin 'vim-scripts/indentpython'
Plugin 'xolox/vim-session'
"Plugin 'Houl/repmo-vim'
Plugin 'vim-python/python-syntax'
"Ultisnips
"Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
"Plugin 'hdima/python-syntax'
Plugin 'wakatime/vim-wakatime'
"Plugin 'jmcomets/vim-pony'
Plugin 'alpertuna/vim-header'
"http://www.vim.org/scripts/script.php?script_id=2154
"Plugin 'vim-scripts/python.vim'
Plugin 'vim-scripts/python_match.vim'
"Marks management
"https://github.com/vim-scripts/marvim
"Plugin 'kshenoy/vim-signature'
"Markdown
"Plugin 'suan/vim-instant-markdown'
Plugin 'lervag/vimtex'
"Plugin 'vim-pandoc/vim-pandoc'
"Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'rhysd/open-pdf.vim'
Plugin 'godlygeek/tabular'
Plugin 'pangloss/vim-javascript'
Plugin 'alcesleo/vim-uppercase-sql'
Plugin 'cosminadrianpopescu/vim-sql-workbench'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"colorscheme industry
"colorscheme morning
"colorscheme breeze
"colorscheme SlateDark
"colorscheme evening
if has ("gui_running")
colorscheme Benokai
else
"colorscheme ron
colorscheme thor
endif
"let g:HardMode_level = 'wannabe'
"let g:HardMode_hardmodeMsg = "Don't fucking use this!"
"autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode()
"set diffexpr=MyDiff()
"function MyDiff()
"let opt = '-a --binary '
"if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
"if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
"let arg1 = v:fname_in
"if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
"let arg2 = v:fname_new
"if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
"let arg3 = v:fname_out
"if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
"let eq = ''
"if $VIMRUNTIME =~ ' '
"if &sh =~ '\<cmd'
"let cmd = '"' . $VIMRUNTIME . '\diff"'
"let eq = '""'
"else
"let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
"endif
"else
"let cmd = $VIMRUNTIME . '\diff'
"endif
"silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
"endfunction
"let g:gtfo#terminals = {'unix' : 'termite & -d'}
"ctrlP options
let g:ctrlp_working_path_mode = 'ra'
"let g:ctrlp_cmd = 'CtrlPMixed'
"map <s-f9> :CTRLpmru <cr>
"Map <A-F9> :CtrlPMixed<CR>
map <c-p><c-o> :CtrlPMixed<CR>
map <c-p><c-p> :CtrlPBuffer<CR>
map <c-p><c-i> :CtrlPRoot<CR>
map <c-p><c-l> :CtrlPTag<CR>
map <c-p><c-[> :CtrlPMRU<CR>
let g:ctrlp_cmd = 'CtrlPMRU'
"let g:colorizer_auto_color = 1
"Is this wrong?
let g:colorizer_auto_filetype='css,html,dosini,xdefaults'
let g:airline#extensions#tabline#enabled = 1
"let g:airline_theme='qwq'
let g:airline_powerline_fonts = 0
"Syntastic
let g:syntastic_python_checkers = ['python']
"vim workspace
let g:workspace_persist_undo_history = 1
let g:workspace_autosave = 1
"Keymappings
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
"Easymotion configs
"let g:Easymotion_mapping_{easymotion-bd-w} = '<c-\>'
"nmap <c-;> <plug>(easymotion-bd-f)
"map s <plug>Sneak_s
"let g:sneak#label = 1
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
"Tim Pope's cursor keyscheme
nmap <Up> [e
nmap <Down> ]e
vmap <Up> [egv
vmap <Down> ]egv
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
nnoremap <Left> :bprevious<Return>
nnoremap <Right> :bnext<Return>
map <F2> :NERDTreeToggle<CR>
map <S-F2> :NERDTreeFind<CR>
"tagbar
nnoremap <silent> <F9> :TagbarToggle<CR>
"vim-header
let g:header_auto_add_header = 0
let g:header_field_author = 'desertsniper87'
let g:header_field_author_email = 'torshobuet@gmail.com'
let g:header_field_filename = 0
"let g:header_field_timestamp
let g:header_field_modified_timestamp = 1
let g:header_field_modified_by = 0
"let g:header_field_timestamp_format
map <F4> :AddHeader<CR>
"extra keycommands
nmap <A-a> :%y+<CR>
"insert mode
function! DelEmptyLineAbove()
if line(".") == 1
return
endif
let l:line = getline(line(".") - 1)
if l:line =~ '^s*$'
let l:colsave = col(".")
.-1d
silent normal! <C-y>
call cursor(line("."), l:colsave)
endif
endfunction
function! AddEmptyLineAbove()
let l:scrolloffsave = &scrolloff
" Avoid jerky scrolling with ^E at top of window
set scrolloff=0
call append(line(".") - 1, "")
if winline() != winheight(0)
silent normal! <C-e>
endif
let &scrolloff = l:scrolloffsave
endfunction
function! DelEmptyLineBelow()
if line(".") == line("$")
return
endif
let l:line = getline(line(".") + 1)
if l:line =~ '^s*$'
let l:colsave = col(".")
.+1d
''
call cursor(line("."), l:colsave)
endif
endfunction
function! AddEmptyLineBelow()
call append(line("."), "")
endfunction
"Vim-easyclip
let g:EasyClipUsePasteToggleDefaults = 0
nmap <space>f <plug>EasyClipSwapPasteForward
nmap <space>d <plug>EasyClipSwapPasteBackwards
let g:EasyClipUseSubstituteDefaults = 1
"nmap <c-s> <plug>SubstituteOverMotionMap
"Delitimate
au FileType html let b:delimitMate_matchpairs = "(:),[:],{:}"
au FileType htmldjango let b:delimitMate_matchpairs = "(:),[:],{:}"
"python-syntax
let g:python_highlight_all = 1
let python_highlight_indent_errors = 0
let python_highlight_space_errors = 0
"ultisnips/supertab
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
"let g:UltiSnipsExpandTrigger = "<tab>"
"let g:UltiSnipsJumpForwardTrigger = "<tab>"
"let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
"vim-session
let g:session_autosave = "yes"
let g:session_autoload = "yes"
let g:session_default_to_last = 1
"open-pdf
let g:pdf_convert_on_read = 1
"closetag.vim
let g:closetag_filenames = '*.html,*.xml,*.phtml,*.conf'
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx'
"Easygrep
let g:EasyGrepMode = 1
"Vim-javascript
"Enables syntax highlighting for JSDocs.
let g:javascript_plugin_jsdoc = 1
"Enables some additional syntax highlighting for NGDocs. Requires JSDoc plugin to be enabled as well.
let g:javascript_plugin_ngdoc = 1
let g:javascript_plugin_flow = 1
"Sp_ace mappings
nnoremap <Space>o :only <CR>
nnoremap <Space>b :bd <CR>
nnoremap <Space>p4 $p
nnoremap <Space>p7 "7P
nnoremap <Space>4 $
vnoremap <Space>4 $
nnoremap <Space>; A:<esc>
nnoremap <Space>w :w <CR>
nnoremap <Space>e :e <CR>
nnoremap <Space>y4 y$ sCR>
nnoremap <Space>ya :%y+ <CR>
nnoremap <Space>rp :!python % <CR>
nnoremap <Space>rs :source % <CR>
nnoremap <Space>rc :g++; ./a.out <CR>
nnoremap <Space>r :cd %:p:h <CR>
nnoremap <backspace> /[()\[\]{}<>]<CR>:noh<CR>
nnoremap <s-backspace> ?[()\[\]{}<>]<CR>:noh<CR>
nnoremap <leader>p i<c-r><s-"><esc>
"au BufNewFile,BufRead *.py
"\ nnoremap <Space>l :!reindent -n % <CR>
"nnoremap <Space>l "+p
"nnoremap <Space>L "+P
"inoremap <Up> : <esc><S-[><i>
"inoremap <Down> : <esc><: S-]><i>
imap <silent> <Left> <C-D>
imap <silent> <Right> <C-T>
inoremap <silent> <Up> <Esc>:call DelEmptyLineAbove()<CR>a
inoremap <silent> <Down> <Esc>:call AddEmptyLineAbove()<CR>a
inoremap <silent> <C-Up> <Esc>:call DelEmptyLineBelow()<CR>a
inoremap <silent> <C-Down> <Esc>:call AddEmptyLineBelow()<CR>a
"Cycling between register
"nnoremap <Leader>s :let @x=@" \| let @"=@a \| let @a=@b \| let @b=@x<CR>
"Easyclip Cut
"let g:EasyClipUseCutDefaults = 0
"nmap d <Plug>MoveMotionPlug
nnoremap gm m