-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
188 lines (180 loc) · 4.91 KB
/
vimrc
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
se nocp nu rnu nobomb wrap wm=79 lbr tw=79 cc=79 ai hi=50 ru so=3 nopaste sc
se wmnu noto nottimeout dy=truncate mouse-=a bg=dark cole=1 hls is showmatch ic
se scs tpm=15 bs=indent,eol,start noet shell=sh enc=UTF-8 scl=auto
se lmap=ЙQ,ЦW,УE,КR,ЕT,НY,ГU,ШI,ЩO,ЗP,Х{,Ъ},ФA,ЫS,ВD,АF,ПG,РH,ОJ,ЛK,ДL,ЯZ
se lmap+=ЧX,СC,МV,ИB,ТN,ЬM,Б<,Ю>,йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],фa,ыs
se lmap+=вd,аf,пg,рh,оj,лk,дl,яz,чx,сc,мv,иb,тn,ьm
no <Up> <Nop>
no <Down> <Nop>
no <Left> <Nop>
no <Right> <Nop>
vn <Up> <Nop>
vn <Down> <Nop>
vn <Left> <Nop>
vn <Right> <Nop>
ino <Up> <Nop>
ino <Down> <Nop>
ino <Left> <Nop>
ino <Right> <Nop>
map <F1> :w<CR>
map <F2> :wq<CR>
map <F4> :NERDTree<CR><C-W>
nmap <F5> :TagbarToggle<CR>
map <F7> :tabp<CR>
map <F8> :tabn<CR>
map <F9> :tabnew<CR>
map Q gq
cal plug#begin()
Plug 'morhetz/gruvbox'
Plug 'lervag/vimtex'
" Plug 'sirver/ultisnips'
" Plug 'honza/vim-snippets'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-commentary'
Plug 'preservim/tagbar'
Plug 'jiangmiao/auto-pairs'
Plug 'airblade/vim-gitgutter'
Plug 'ap/vim-css-color'
Plug 'christoomey/vim-sort-motion'
Plug 'christoomey/vim-titlecase'
Plug 'dense-analysis/ale'
Plug 'gcmt/taboo.vim'
Plug 'vim-test/vim-test'
Plug 'romainl/vim-cool'
Plug 'simnalamburt/vim-mundo'
Plug 'junegunn/gv.vim'
Plug 'junegunn/rainbow_parentheses.vim'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-speeddating'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'PhilRunninger/nerdtree-visual-selection'
Plug 'ryanoasis/vim-devicons'
Plug 'timcharper/textile.vim'
cal plug#end()
" PlugUpdate
" PlugInstall
colo gruvbox
let g:NERDTreeFileLines = 1
let g:NERDTreeGitStatusUntrackedFilesMode = 'all'
let g:NERDTreeGitStatusUseNerdFonts = 1
let g:gruvbox_contrast_dark = 'hard'
let g:tex_flavor = 'latex'
let g:vimtex_view_method = 'zathura'
let g:vimtex_quickfix_mode = 0
let g:tex_conceal = 'abdmg'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = 'c-b'
let g:UltiSnipsJumpBackwardTrigger = '<c-z>'
filetype detect
if &filetype == "html" || &filetype == "css"
se ts=2 sw=2 nolbr cc=140 tw=140
elsei &filetype == "asm"
se ts=8 sw=8 et nolbr
elsei &filetype == "go"
se nolbr
elsei &filetype == "haskell"
se cc=75 tw=75 nolbr ts=2 sw=2 et
en
fu PrepareBeforeWrite()
if &filetype == "python"
%s/^ / /e
en
%s/\s\+$//e
%s/\^datetime\^/\=strftime("%c")/e
se fenc=utf-8
endf
fu StatuslineTrailingSpaceWarning()
if !exists("b:statusline_trailing_space_warning")
if !&modifiable
let b:statusline_trailing_space_warning = ''
retu b:statusline_trailing_space_warning
en
if search('\s\+$', 'nw') != 0
let b:statusline_trailing_space_warning = '[\s]'
else
let b:statusline_trailing_space_warning = ''
en
en
retu b:statusline_trailing_space_warning
endf
fu StatuslineCurrentHighlight()
let name = synIDattr(synID(line('.'),col('.'), 1), 'name')
if name == '' | retu '' | else | retu '[' . name . ']' | en
endf
fu StatuslineLongLineWarning()
if !exists("b:statusline_long_line_warning")
if !&modifiable
let b:statusline_long_line_warning = ''
retu b:statusline_long_line_warning
en
let long_line_lens = s:LongLines()
if len(long_line_lens) > 0
let b:statusline_long_line_warning = "[" .
\ '#' . len(long_line_lens) . "," .
\ 'm' . s:Median(long_line_lens) . "," .
\ '$' . max(long_line_lens) . "]"
else
let b:statusline_long_line_warning = ""
en
en
retu b:statusline_long_line_warning
endf
fu s:LongLines()
let threshold = (&tw ? &tw : 80)
let spaces = repeat(" ", &ts)
let long_line_lens = []
let i = 1
while i <= line("$")
let len = strlen(substitute(getline(i), '\t', spaces, 'g'))
if len > threshold
cal add(long_line_lens, len)
en
let i += 1
endw
retu long_line_lens
endf
fu s:Median(nums)
let nums = sort(a:nums)
let l = len(nums)
if l % 2 == 1
let i = (l - 1) / 2
retu nums[i]
else
retu nums[l / 2] + nums[(l / 2) - 1] / 2
en
endf
se ls=2
se stl=%-03.f
se stl+=%#warningmsg#
se stl+=%{&ff!='unix'?'['.&ff.']':''}
se stl+=%*
se stl+=%#warningmsg#
se stl+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
se stl+=%*
se stl+=%h%y%r%m
se stl+=%{StatuslineTrailingSpaceWarning()}
se stl+=%{StatuslineLongLineWarning()}
se stl+=%#warningmsg#
se stl+=%#error#
se stl+=%{&paste?'[paste]':''}
se stl+=%*
se stl+=%{FugitiveStatusline()}
se stl+=%=
se stl+=%{StatuslineCurrentHighlight()}\ \
se stl+=%c,
se stl+=%l/%L
se stl+=\ %P
au cursorhold,bufwritepost * unl! b:statusline_trailing_space_warning
au cursorhold,bufwritepost * unl! b:statusline_long_line_warningS
au StdinReadPre * let s:std_in=1
au VimEnter * NERDTree | if argc() > 1 || exists("s:std_in") | winc p | endi
au VimEnter * GitGutterEnable
au BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endi
au BufWritePost * GitGutter
aug PreWriteEdits
au BufWritePre * cal PrepareBeforeWrite()
aug END
syntax on