forked from amix/vimrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_configs.vim
192 lines (147 loc) · 5.32 KB
/
my_configs.vim
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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
" let ale using compile_commands.json
let g:ale_c_parse_compile_commands = 1
" No fold view on opening buffer
au BufReadPre * :se foldlevel=99
" Keep fold view
set foldlevelstart=-1
" set default foldmethod
set foldmethod=syntax
let g:bufExplorerSortBy='mru'
nnoremap <silent> * :let @/ = '\<' . escape(expand('<cword>'), '\') . '\>'<CR>:se hls<CR>
let g:ale_python_pylint_executable='pylint3'
let g:ale_python_pylint_options='--disable=missing-docstring,import-error'
let g:ale_python_mypy_options=' --check-untyped-defs'
" E402 - Module level import not at top of file
" F401 - Module imported but unused
" W503 - line break before binary operator
" W504 - line break after binary operator
" E501 - Tool long line (Let's check this with colorcolumn)
let g:ale_python_flake8_options = ' --ignore=E402,W503,W504,E501 --per-file-ignores="__init__.py:F401"'
" indentation on wrap
set breakindent
set breakindentopt=shift:0,min:20
set showbreak=\|
" This is for 'NerdTree copy path to clipboard' working as expected
if has("mac") || has("macunix")
set clipboard=unnamed
elseif has("win32")
set clipboard=unnamed
elseif has("linux")
set clipboard=unnamedplus
endif
" Disable `CTRL-A` behavior. Original behavior is to increment number.
" See `:help CTRL-A` for detail
map <C-a> <Nop>
" Disable mouse feature
set mouse=
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Filetype specific configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" python
au FileType python setl foldmethod=indent
au FileType python setl colorcolumn=100
" cmake
au FileType cmake setl foldmethod=indent
" flatbuffers
" TODO apply proper setting for flatbuffers
au BufRead *.fbs setl syntax=cpp
" sh
au FileType sh setl foldmethod=marker
au FileType sh setl foldmarker={,}
" Makefile
au FileType make setl foldmethod=indent
au FileType make setl shiftwidth=4
" Protobuf schema
au FileType proto setl foldmethod=marker
au FileType proto setl foldmarker={,}
" Protobuf text
au BufRead *.pbtxt setl syntax=java
au BufRead *.pbtxt setl foldmethod=marker
au BufRead *.pbtxt setl foldmarker={,}
" *.bzl
au BufRead *.bzl setl foldmethod=indent
au BufRead *.BUILD setl syntax=bzl
au BufRead BUILD.* setl syntax=bzl
" yaml
au FileType yaml setl foldmethod=indent
" jinja
au BufRead *.jinja setl syntax=yaml
au BufRead *.jinja setl foldmethod=indent
" go
au FileType go setl tabstop=2
au FileType go let &l:shiftwidth=&l:tabstop
" groovy
au FileType groovy setl foldmethod=marker
au FileType groovy setl foldmarker={,}
" Jenkinsfile
au BufRead Jenkinsfile setl syntax=groovy
au BufRead Jenkinsfile setl foldmethod=marker
au BufRead Jenkinsfile setl foldmarker={,}
" xml
au FileType xml setl foldmethod=indent
" swift
au BufRead *.swift setl syntax=javascript
au BufRead *.swift setl foldmethod=marker
au BufRead *.swift setl foldmarker={,}
" git ISSUE_EDITMSG (for `hub` executable)
au BufRead ISSUE_EDITMSG setl syntax=markdown
au BufRead ISSUE_EDITMSG setl filetype=markdown
au BufRead ISSUE_EDITMSG setl foldmethod=syntax
au BufRead ISSUE_EDITMSG setl textwidth=500
" Graphviz dot
au FileType dot setl foldmethod=marker
au FileType dot setl foldmarker={,}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Enhance fold view
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! FoldText()
" Description: Folding configuration
" TODO ALE indication column is not counted
let winwidth = winwidth(0)
\ - &fdc
\ - &number*&numberwidth
\ - (&l:signcolumn is# 'yes' ? 2 : 0)
let foldlinecount = foldclosedend(v:foldstart) - foldclosed(v:foldstart) + 1
let foldinfo = " ( " . string(foldlinecount) . " lines ) "
let tabreplace = repeat(" ", &tabstop)
let foldstartline = substitute(getline(v:foldstart), '[\t]', tabreplace, 'g')
if &foldmethod == "indent"
let foldsummary = foldstartline . "..."
else
let foldendline = substitute(getline(v:foldend), '^\s*\(.\{-}\)\s*$', '\1', '')
let foldsummary = foldstartline . "..." . foldendline
endif
let cuttedsummary = strpart(foldsummary, 0 , winwidth - len(foldinfo))
let fillcharcount = winwidth - len(cuttedsummary) - len(foldinfo)
return cuttedsummary . repeat(" ",fillcharcount) . foldinfo
endfunction
set foldtext=FoldText()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => fzf plugin
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Overwrite this in local configure to append system specific fzf rtp
set runtimepath+=~/.fzf
map <C-f> :FZF<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Call local configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
try
source ~/.vim_runtime/my_configs_local.vim
catch
endtry
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => ETC
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set highlight group color scheme
highlight SignColumn ctermfg=none ctermbg=none
highlight DiffAdd ctermfg=none ctermbg=16
highlight DiffChange ctermfg=none ctermbg=16
highlight DiffText ctermfg=none ctermbg=52
highlight DiffDelete ctermfg=none ctermbg=none
highlight ColorColumn ctermbg=235
" No ignore exception on folding
set foldignore=""