-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
228 lines (220 loc) · 6.25 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
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
set nocompatible number relativenumber nobomb wrap wrapmargin=79 linebreak
\ textwidth=79 cc=79 autoindent hi=50 ru so=3 nopaste sc wildmenu notimeout
\ nottimeout display=truncate mouse-=a bg=dark conceallevel=1 hlsearch is
\ showmatch ignorecase scs tabpagemax=15 noexpandtab shell=bash
\ encoding=UTF-8 scl=auto
\ lmap=ЙQ,ЦW,УE,КR,ЕT,НY,ГU,ШI,ЩO,ЗP,Х{,Ъ},ФA,ЫS,ВD,АF,ПG,РH,ОJ,ЛK,ДL,ЯZ
\ lmap+=ЧX,СC,МV,ИB,ТN,ЬM,Б<,Ю>,йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],фa,ыs
\ lmap+=вd,аf,пg,рh,оj,лk,дl,яz,чx,сc,мv,иb,тn,ьm
" set backspace=indent,eol,start
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
noremap <Insert> <Nop>
noremap <Del> <Nop>
noremap <BS> <Nop>
noremap <Home> <Nop>
noremap <End> <Nop>
noremap <PageUp> <Nop>
noremap <PageDown> <Nop>
noremap <F1> <Nop>
noremap <F2> <Nop>
noremap <F3> <Nop>
noremap <F4> <Nop>
noremap <F5> <Nop>
noremap <F6> <Nop>
noremap <F7> <Nop>
noremap <F8> <Nop>
noremap <F9> <Nop>
noremap <F10> <Nop>
noremap <F11> <Nop>
noremap <F12> <Nop>
vnoremap <Up> <Nop>
vnoremap <Down> <Nop>
vnoremap <Left> <Nop>
vnoremap <Right> <Nop>
vnoremap <Insert> <Nop>
vnoremap <Del> <Nop>
vnoremap <BS> <Nop>
vnoremap <Home> <Nop>
vnoremap <End> <Nop>
vnoremap <PageUp> <Nop>
vnoremap <PageDown> <Nop>
vnoremap <F1> <Nop>
vnoremap <F2> <Nop>
vnoremap <F3> <Nop>
vnoremap <F4> <Nop>
vnoremap <F5> <Nop>
vnoremap <F6> <Nop>
vnoremap <F7> <Nop>
vnoremap <F8> <Nop>
vnoremap <F9> <Nop>
vnoremap <F10> <Nop>
vnoremap <F11> <Nop>
vnoremap <F12> <Nop>
inoremap <Up> <Nop>
inoremap <Down> <Nop>
inoremap <Left> <Nop>
inoremap <Right> <Nop>
inoremap <Insert> <Nop>
inoremap <Del> <Nop>
inoremap <BS> <Nop>
inoremap <Home> <Nop>
inoremap <End> <Nop>
inoremap <PageUp> <Nop>
inoremap <PageDown> <Nop>
inoremap <F1> <Nop>
inoremap <F2> <Nop>
inoremap <F3> <Nop>
inoremap <F4> <Nop>
inoremap <F5> <Nop>
inoremap <F6> <Nop>
inoremap <F7> <Nop>
inoremap <F8> <Nop>
inoremap <F9> <Nop>
inoremap <F10> <Nop>
inoremap <F11> <Nop>
inoremap <F12> <Nop>
map Q gq
call 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'
call plug#end()
" PlugUpdate
" PlugInstall
colorscheme 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"
set ts=2 sw=2 nolinebreak cc=140 textwidth=140
elsei &filetype == "asm"
set ts=8 sw=8 expandtab nolinebreak
elsei &filetype == "go"
set nolinebreak
elsei &filetype == "haskell"
set cc=75 textwidth=75 nolinebreak ts=2 sw=2 expandtab
endif
function PrepareBeforeWrite()
if &filetype == "python"
%s/^ / /e
endif
%s/\s\+$//e
%s/\^datetime\^/\=strftime("%c")/e
set fileencoding=utf-8
endfunction
function StatuslineTrailingSpaceWarning()
if !exists("b:statusline_trailing_space_warning")
if !&modifiable
let b:statusline_trailing_space_warning = ''
return b:statusline_trailing_space_warning
endif
if search('\s\+$', 'nw') != 0
let b:statusline_trailing_space_warning = '[\s]'
else
let b:statusline_trailing_space_warning = ''
endif
endif
return b:statusline_trailing_space_warning
endfunction
function StatuslineCurrentHighlight()
let name = synIDattr(synID(line('.'),col('.'), 1), 'name')
if name == '' | return '' | else | return '[' . name . ']' | endif
endfunction
function StatuslineLongLineWarning()
if !exists("b:statusline_long_line_warning")
if !&modifiable
let b:statusline_long_line_warning = ''
return b:statusline_long_line_warning
endif
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 = ""
endif
endif
return b:statusline_long_line_warning
endfunction
function 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
call add(long_line_lens, len)
endif
let i += 1
endwhile
return long_line_lens
endfunction
function s:Median(nums)
let nums = sort(a:nums)
let l = len(nums)
if l % 2 == 1
let i = (l - 1) / 2
return nums[i]
else
return nums[l / 2] + nums[(l / 2) - 1] / 2
endif
endfunction
set ls=2
set stl=%-03.f%#warningmsg#%{&ff!='unix'?'['.&ff.']':''}%*%#warningmsg#
set stl+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}%*%h%y%r%m
set stl+=%{StatuslineTrailingSpaceWarning()}
set stl+=%{StatuslineLongLineWarning()}
set stl+=%#warningmsg#%#error#%{&paste?'[paste]':''}%*
set stl+=%{FugitiveStatusline()}%=
set stl+=%{StatuslineCurrentHighlight()}\ \%c,%l/%L\ %P
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
autocmd cursorhold,bufwritepost * unlet! b:statusline_long_line_warningS
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * NERDTree | if argc() > 1 || exists("s:std_in") | wincmd p | endif
autocmd VimEnter * GitGutterEnable
autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif
autocmd BufWritePost * GitGutter
augroup PreWriteEdits
autocmd BufWritePre * call PrepareBeforeWrite()
augroup END
syntax on