-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.me
663 lines (558 loc) · 22.4 KB
/
vimrc.me
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
658
659
660
661
662
" ███████╗██╗ ██╗ ██╗███╗ ███╗ █████╗ ███╗ ██╗
" ██╔════╝██║ ╚██╗ ██╔╝████╗ ████║██╔══██╗████╗ ██║
" █████╗ ██║ ╚████╔╝ ██╔████╔██║███████║██╔██╗ ██║
" ██╔══╝ ██║ ╚██╔╝ ██║╚██╔╝██║██╔══██║██║╚██╗██║
" ██║By ███████╗██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║
" ╚═╝ROBIN╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""" UNIVERSAL VIM OPTIONS THAT WE ARE ALL AGREED """"""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
set mouse=a
set modeline
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Show matching brackets when text indicator is over them
set showmatch
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Turn on the Wild menu
set wildmenu
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Use spaces instead of tabs
set expandtab
set autoindent
set smartindent
set showcmd "Always print current keystroke
set ruler "Always show current position
" Work with longline
set display+=lastline
set encoding=utf8
" Disable all bell audio sound
set belloff=all
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General Options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=500
" Enable filetype plugins
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
set autoread
" Use Unix as the standard file type
set ffs=unix,dos,mac
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface element
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" A buffer becomes hidden instead of dropped
set hidden
set confirm
" Don't redraw while executing macros (good performance config)
set lazyredraw
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Filename
set isfname-==
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" turn backup off, since most stuff is in svn, git et.c anyway...
set nobackup
set nowb
set noswapfile
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
set wildignore+=.git\*,.hg\*,.svn\*
else
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif
" For gf shortcut, last resort to remove leading slash from filename to find
" the file
set includeexpr=substitute(v:fname,'^/','','-g')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Buffers, Split Windows, Tabs(Tabline)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Specify the behavior when switching/opening new buffers
if v:version >= 740
set switchbuf=useopen,usetab
endif
" Always Show tabline
set showtabline=2
" Set Split Position
set splitright
set splitbelow
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Set Preferred Input Timeout
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set notimeout
set ttimeout
set ttimeoutlen=0 " No keycode dealy - no esc dealy
set scrolloff=0 " allow cursor to be at top and bottom
silent! packadd! matchit
nnoremap q :q<cr>
nnoremap K K<cr>
"""""""""""""""""""""""""""""""""""""""""
let mapleader = "\<space>"
"""""""""""""""""""""""""""""""""""""""""
"" All leader key mapping
"""""""""""""""""""""""""""""""""""""""""
" Select Buffer And Go
nnoremap <leader>b :ls<cr>:buffer
" Open empty tab or with filename
nnoremap <leader>t :tabe<space>
" quickfix window displaying
nnoremap <leader>q :botright copen<cr>
nnoremap <leader>z :-tab split<cr>
nnoremap ]p :cnext<cr>
nnoremap [p :cprev<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General Vim Editor Setup
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <silent> <leader>l :set number! list!<cr>
"Split the line below with space, reverse of J
nnoremap <leader>j v$hdO<Esc>pj
" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
" Disable highlight when <space><enter> is pressed
nnoremap <silent> <expr> <cr> &buftype ==# 'quickfix' ? "\<cr>" : ":noh<cr>"
" Esc, Ctrl, :, ^W, ^s, Tab, Alt
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>sp :setlocal spell!<cr>
" z= provide a list of replacement
" zg add word to definition
" ]s next spell error
" [s previous spell error
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
" noremap <leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Repeat last typed command
nnoremap <leader><space> @:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Fast editing and reloading of vimrc configs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>ee :e! ~/.vimrc<cr>
map <leader>et :e! ~/.tmux.conf<cr>
map <leader>ez :e! ~/.zshrc<cr>
noremap <leader>r :source $MYVIMRC<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" END of Leader Key mapping
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Extra Normal Mode Mapping
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
noremap Q q
map <MiddleMouse> <Nop>
imap <MiddleMouse> <Nop>
" for practicing vim way
" nnoremap <silent> <up> <NOP>
" nnoremap <silent> <down> <NOP>
" nnoremap <silent> <left> <NOP>
" nnoremap <silent> <right> <NOP>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => InertMode/CMDline Editing mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Additionaly you can use c-f to editing cmd in normal mode window
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
cnoremap <C-D> <S-Right><C-W>
cnoremap <C-P> <Up>
cnoremap <C-N> <Down>
cnoremap <C-Y> <C-R>"
inoremap <silent> <ESC> <ESC>:call IMEKeyboard()<CR>
func! IMEKeyboard()
call system('fcitx-remote -c')
endfun
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vim Built-in Terminal related config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has('terminal')
packadd termdebug
endif
" :W sudo saves the file
" (useful for handling the permission-denied error)
command! W :execute ':silent w !sudo tee % > /dev/null' | :edit!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Pattern Match, Search Highlight with * key
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Normal mode pressing * or # searches for word under cursor
" enable * # for visual selected text
" whitespace match any whitespace in potential result
let s:save_cpo = &cpo | set cpo&vim
function! s:VSetSearch(cmd)
let old_reg = getreg('"')
let old_regtype = getregtype('"')
normal! gvy
if @@ =~? '^[0-9a-z,_]*$' || @@ =~? '^[0-9a-z ,_]*$'
let @/ = @@
else
let pat = escape(@@, a:cmd.'\')
let pat = substitute(pat, '\n', '\\n', 'g')
let @/ = '\V'.pat
endif
normal! gV
call setreg('"', old_reg, old_regtype)
endfunction
vnoremap <silent> * :<C-U>call <SID>VSetSearch('/')<cr>/<C-R>/<cr>
vnoremap <silent> # :<C-U>call <SID>VSetSearch('?')<cr>?<C-R>/<cr>
vmap <kMultiply> *
let &cpo = s:save_cpo | unlet s:save_cpo
nnoremap * *``
nnoremap # #``
" Delete trailing white space on save, useful for some filetypes ;)
func! CleanExtraSpaces()
let save_cursor = getpos(".")
let old_query = getreg('/')
silent! %s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfun
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""" Utility Functions """"""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" returns the binary string representation of a number.
function! Nr2Bin(nr)
let n = a:nr
let r = ""
while n
let r = '01'[n % 2] . r
let n = n / 2
endwhile
return r
endfunc
command! CloseHiddenBuffers call s:CloseHiddenBuffers()
function! s:CloseHiddenBuffers()
let open_buffers = []
for i in range(tabpagenr('$'))
call extend(open_buffers, tabpagebuflist(i + 1))
endfor
for num in range(1, bufnr("$") + 1)
if buflisted(num) && index(open_buffers, num) == -1
exec "bdelete ".num
endif
endfor
endfunction
iab xdate <c-r>=strftime("%F")<cr>
iab xdate2 <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
" :HeadPager use visidata command instead
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Code Navigation - Cscope/LanguageClient
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! LoadCscope()
let pwd = getcwd()
echo expand('%:p:h')
lcd %:p:h
set nocscopeverbose
let db1 = findfile("GTAGS", ";.")
let db2 = findfile("cscope.out", ";.")
if (!empty(db1)) && executable('gtags-cscope')
set cscopeprg=gtags-cscope
exe "cs add " . db1 . " " . fnamemodify(db1,":p:h") . " -a"
elseif (!empty(db2)) && executable('cscope')
exe "cs add " . db2 . " " . fnamemodify(db2,":p:h")
elseif $CSCOPE_DB != ""
"add database pointed to by environment variable
cs add $CSCOPE_DB $CSCOPE_DB_PREFIX
endif
set cscopeverbose
exe "lcd" . " " . pwd
redraw
endfunction
if has("cscope")
"set cscopequickfix=g-,s-,c-,f-,i-,t-,d-,e-
set cscopequickfix=
" add any cscope database in current directory
map <leader>ca :call LoadCscope()<cr>
" show msg when any other cscope db added
set cscopeverbose
" seach for definition
map <leader>gd :cs find g <c-r><c-w>
" search for this symbol
map <leader>gs :cs find s <c-r><c-w>
" find the file under the name
map <leader>gf :cs find f <c-r>=expand("<cfile>")<cr>
" search files that include this file
map <leader>gi :cs find i <c-r>=expand("%:t")<cr>
" egrep pattern matching
map <leader>ge :cs find e <c-r><c-w>
" Find assignments to this symbol
map <leader>ga :cs find a <c-r><c-w>
" search functions that call this function
map <leader>gc :cs find c <c-r><c-w>
endif
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
function! LoadCocBinding()
" CoC
map <buffer> <leader>gd <Plug>(coc-definition)
map <buffer> <leader>gs <Plug>(coc-references)
map <buffer> <leader>gr <Plug>(coc-rename)
map <buffer> <leader>gi <Plug>(coc-implementation)
map <buffer> ]p <Plug>(coc-diagnostic-next)
map <buffer> [p <Plug>(coc-diagnostic-prev)
map <buffer> <silent> = :call CocAction('format')<cr>
nnoremap <buffer> <silent> K :call <SID>show_documentation()<cr>
command! -nargs=0 Format :call CocAction('format')
setlocal formatexpr=CocAction('formatSelected')
endfunction
"""""""""""""""""""""""""""""""""""""""""
"" Code/Text AutoFormat,AutoComplete
"""""""""""""""""""""""""""""""""""""""""
function! SetupCodeEnvironment()
"set trigger for language-client's omnifunc
if &filetype == 'c' || &filetype == 'cpp'
call LoadCscope()
if executable('clang-format')
setlocal formatprg=clang-format\ --style='Webkit'
setlocal equalprg=clang-format\ --style='Webkit'
endif
elseif &ft == 'javascript'
elseif &ft == 'python'
elseif &ft == 'make'
setlocal noexpandtab tabstop=8 shiftwidth=8
elseif &ft == 'rust'
call LoadCocBinding()
elseif &ft == 'elm'
call LoadCocBinding()
endif
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Start of Plugin and External Dependency
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if empty(glob('~/.vim/autoload/plug.vim')) && !has('win32')
silent !mkdir -p ~/.vim/temp_dirs/undodir > /dev/null 2>&1
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > /dev/null 2>&1
if v:shell_error == 0
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
" for windows oni or neovim, manually install using powershell
" and install git for windows as well, run ` PlugInstall --sync | source $MYVIMRC ` Afterward
if 0
md ~\AppData\Local\nvim\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile( $uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath( "~\AppData\Local\nvim\autoload\plug.vim"))
endif
if executable('nvim') && empty(glob('~/.config/nvim/init.vim')) && !has('win32')
silent! !mkdir -p ~/.config
silent! !ln -sf ~/.vim ~/.config/nvim
silent! !ln -sf ~/.vimrc ~/.config/nvim/init.vim
endif
if has('nvim')
set viminfo+=n~/.vim/.nviminfo
else
"nviminfo is not compatable with viminfo
set viminfo+=n~/.vim/.viminfo
set ttymouse=sgr
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Turn persistent undo on
" means that you can undo even when you close a buffer/vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
try
set undodir=~/.vim/temp_dirs/undodir
set undofile
catch
endtry
endif
" PLUGIN MANAGER START {{
if !empty(glob('~/.vim/autoload/plug.vim'))
call plug#begin('~/.vim/plugged')
""""""""""""""""""""""""""""""
Plug 'mhinz/vim-startify'
""""""""""""""""""""""""""""""
" Plug 'vim-airline/vim-airline'
" Plug 'itchyny/lightline.vim'
Plug 'NLKNguyen/papercolor-theme'
""""""""""syntax and colorscheme"""""""""""""""""""
Plug 'sheerun/vim-polyglot'
""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
" VIM's OPERATOR/TEXT OBJECT "
""""""""""""""""""""""""""""""
Plug 'tpope/vim-commentary', { 'on': '<Plug>Commentary' }
""""""""""""""""""""""""""""""
Plug 'wellle/targets.vim'
""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""" "On demand loading
Plug 'chrisbra/Colorizer', { 'on': [ 'ColorHighlight', 'ColorToggle' ] }
""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'}
""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
let g:undotree_CustomUndotreeCmd = 'vertical aboveleft 32 new'
let g:undotree_CustomDiffpanelCmd= 'belowright 12 new'
""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
":h easyalign "check the helpdoc line 468 after load the plugin
Plug 'junegunn/vim-easy-align', { 'on': ['<Plug>(EasyAlign)','EasyAlign']}
""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
Plug 'tpope/vim-fugitive', {'on': ['Gwrite','Git']}
""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
" Installation:
" !curl -sL install-node.now.sh/lts | bash
" :CocInstall coc-rust-analyzer
" :CocCommand rust-analyzer.analyzerStatus
" npm install -g @elm-tooling/elm-language-server elm elm-test elm-format
" LSP for Rust with rust-analyzer
Plug 'neoclide/coc.nvim', {'branch': 'release', 'for': ['rust', 'elm']}
""""""""""""""""""""""""""""""
Plug 'vimwiki/vimwiki'
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
call plug#end()
"}} PLUGIN MANAGER END
endif
silent! packadd! matchit
"""""""""""""""""""""""""""""""""""""""""
""PLUGIN LEADER KEY MAPPING"
"""""""""""""""""""""""""""""""""""""""""
" easy-alignment no argument go to interactive mode
vmap <leader>a :EasyAlign
nmap <leader>u :UndotreeToggle<cr>
map <leader>m :TagbarToggle<cr>
map gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" End of Plugin and External Dependency
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => colors , fonts, display, highlight
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! DisplayReloadTheme()
silent! colorscheme default
set background=dark
silent! colorscheme PaperColor
" Set the Syntax
syntax on
set cursorline
if $TERM =~? '256color'
set t_Co=256
endif
" show hidden chars using shortcuts
" set listchars=tab:␉·,eol:,nbsp:▓
set listchars=tab:␉·,nbsp:▓
set list
set number
" two highlight group nontext & specialkey for listchars
highlight nontext ctermfg=238 guifg=#414141
" override color scheme for the listchars "#649a9a
highlight CursorColumn guibg=#404040 gui=bold cterm=bold ctermbg=234
highlight CursorColumnNR guibg=#404040 gui=bold cterm=bold ctermbg=234
highlight CursorLine cterm=bold ctermfg=black ctermbg=green
highlight CursorLineNR cterm=bold ctermbg=black
" addtional cursor color need to be set in your terminal emulator
highlight QuickFixLine cterm=bold ctermfg=brown ctermbg=black
highlight QuickFixLine gui=bold guibg=black
highlight Visual cterm=bold ctermbg=white ctermfg=black
highlight Visual gui=bold guibg=white guifg=black
highlight Search cterm=bold ctermbg=Yellow ctermfg=black
highlight Search gui=bold guibg=Brown guifg=black
set laststatus=2 "In order to show the good statusline
set showcmd "Always print current keystroke
set ruler "Always show current position
set cmdheight=1 "Height of the command bar
set statusline=
set statusline+=\ %(第%c列%)
set statusline+=\ %f\ %r%w " filename and flags
set statusline+=\ %(共%L行%)
set statusline+=%=%< " force space and start cut if too long
set statusline+=\ [%{getcwd()}][%{&ft}] " flags and filetype
set statusline+=\ [UTF-8:%B][Buf:%n]\ " unicode under cursor
highlight Statusline cterm=bold ctermfg=black ctermbg=white
highlight Statusline gui=bold guifg=black guibg=#b0dfe5
highlight StatusLineNC cterm=NONE ctermfg=black ctermbg=grey
highlight StatuslineNC gui=NONE guibg=#64645e guifg=#75715E
if has('terminal')
highlight StatuslineTerm cterm=bold ctermfg=black ctermbg=cyan
highlight StatuslineTerm gui=bold guifg=black guibg=#b0dfe5
highlight StatusLineTermNC cterm=NONE ctermfg=black ctermbg=grey
highlight StatuslineTermNC gui=NONE guibg=#64645e guifg=#75715E
" for vim debug highlight
highlight debugPC ctermbg=red ctermfg=white cterm=bold
endif
highlight TabLine cterm=NONE ctermfg=black ctermbg=white
highlight TabLine gui=NONE guifg=black guibg=#555555
highlight TabLineFill cterm=bold ctermfg=black ctermbg=white
highlight TabLineFill gui=NONE guifg=#8F908A guibg=#555555
highlight TabLineSel cterm=bold ctermfg=white ctermbg=black
highlight TabLineSel gui=bold guifg=red guibg=#36454F
"DiffText name is misleading, it mean text that is different
"DiffChange name is misleading, it mean text that is the same
highlight DiffAdd cterm=bold ctermfg=green ctermbg=black
highlight DiffDelete cterm=bold ctermfg=red ctermbg=black
highlight DiffText cterm=bold ctermfg=brown ctermbg=black
highlight DiffChange cterm=bold ctermfg=white ctermbg=black
highlight MatchParen cterm=bold ctermfg=white ctermbg=brown
highlight Folded cterm=bold ctermfg=cyan ctermbg=none
highlight Pmenu cterm=bold ctermfg=white ctermbg=DarkMagenta
highlight PmenuSel cterm=reverse ctermfg=white ctermbg=DarkMagenta
highlight PmenuThumb cterm=bold ctermbg=white
" Customer User Color %1*text%0*
" highlight User1 cterm=NONE ctermfg=59 ctermfg=235
" highlight User1 gui=bold guifg=red guibg=#b0dfe5
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""" AUTO COMMANDS """""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("autocmd")
augroup myvimrc
autocmd! *
" Auto reload conffiguration file, clean whitespace for some common code files
autocmd BufWritePost ~/.vimrc nested source ~/.vimrc | :call DisplayReloadTheme()
autocmd BufWritePost ~/.Xresources :call system('xrdb -merge ~/.Xresources')
autocmd BufWritePre Makefile,vimrc,*.txt,*.js,*.py,*.sh,*.rs,*.vue :call CleanExtraSpaces()
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" Save the code folding if we had one
" autocmd BufWinLeave * silent! mkview
" autocmd BufWinEnter * silent! loadview
" if v:version >= 800
" " auto save
" autocmd TextChanged * let v:errmsg = '' | silent! write | if v:errmsg == '' | write | endif
" autocmd InsertLeave * let v:errmsg = '' | silent! write | if v:errmsg == '' | write | endif
" endif
autocmd VimEnter * :let i = 0 | while i < 100 | mark ' | let i = i + 1 | endwhile
" smart cursorline
autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
" tab special for makefile
autocmd FileType json syntax match Comment +\/\/.\+$+
autocmd FileType * :call SetupCodeEnvironment()
augroup END
endif
call DisplayReloadTheme()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""" END OF VIM OPTIONS SETTING """"""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim: set ft=vim :