-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
279 lines (216 loc) · 7.01 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
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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => vim-plug
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
" add all your plugins here
" Plug 'monkey/bananas' is shorthand for
" Plug 'https://github.com/monkey/bananas'
" No BS code folding for python
Plug 'tmhedberg/SimpylFold'
" Better python indentation
" Plug 'vim-scripts/indentpython.vim'
Plug 'Vimjas/vim-python-pep8-indent'
" Auto pep8
Plug 'tell-k/vim-autopep8'
" Autocomplete
Plug 'Valloric/YouCompleteMe'
"Plug 'maralla/completor.vim'
" Latex tools
Plug 'vim-latex/vim-latex'
" Git mergetool
"Plug 'whiteinge/diffconflicts'
" Git commands
Plug 'tpope/vim-fugitive'
" Syntax error checking.
" Plug 'vim-syntastic/syntastic'
Plug 'dense-analysis/ale'
" The plugin needs external syntax checkers
" Checker for python syntax and style
" Plug 'nvie/vim-flake8'
" Color schemes
Plug 'nanotech/jellybeans.vim'
Plug 'jnurmine/Zenburn'
Plug 'morhetz/gruvbox'
Plug 'ciaranm/inkpot'
Plug 'xiaody/thornbird.vim'
Plug 'sjl/badwolf'
Plug 'joshdick/onedark.vim'
Plug 'challenger-deep-theme/vim'
" Syntax highlighting
" Python
Plug 'vim-python/python-syntax'
" Syntax highlighting and indentation for haskell
Plug 'neovimhaskell/haskell-vim'
" Rainbow parenthesis
Plug 'luochen1990/rainbow'
" Concealment for haskell
Plug 'enomsg/vim-haskellConcealPlus'
" All of your Plugins must be added before the following line
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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
" Set leader (this is the default)
let mapleader = '\'
" Set encoding
set encoding=utf-8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set n lines to the cursor - when moving vertically using j/k
set scrolloff=3
" Set n characters to the cursor when moving right and left
set sidescrolloff=5
"Always show current position
set ruler
" Set row numbers and relative numbers
set number
set relativenumber
" Height of the command bar
set cmdheight=1
" Show commands as they are typed
set showcmd
" Always show tabline
set showtabline=2
" Display command line’s tab complete options as a menu.
set wildmenu
" A buffer becomes hidden when it is abandoned
" set hid
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Incremental search
set incsearch
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Make code look pretty
let python_highlight_all=1
syntax on
" Set colorscheme
"colorscheme my_challenger_deep
colorscheme onedark
" Let challenger_deep do italics even in terminal
let g:challenger_deep_terminal_italics = 1
" Options for haskell concealing
let hscouptions="s𝐌"
" Rainbow parentheses
let g:rainbow_active = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Statusline
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Always show statusline
set laststatus=2
" Get current git branch
function! GitBranch(git)
if a:git == ""
return '-'
else
return a:git
endif
endfunction
" If file is a tex file, run texcount on save and output to statusline
let g:latex_wc=""
augroup latexstatus
autocmd!
" Whenever a tex file is written, Read or entered (e.g. when switching to
" tab) count the words
autocmd BufWritePost,BufRead,BufEnter *.tex :let g:latex_wc=GetWC()." words"
" Whenever tex file is left, do not display a wordcount
autocmd BufLeave *.tex :let g:latex_wc=""
augroup END
" Get the texcount wordcount for current file
function! GetWC()
let l:tmp=system("texcount"." ".expand('%'))
let l:tmp1=system("grep 'Words in text'", l:tmp)
let l:tmp2=system("egrep -o -e '[0-9]+'", l:tmp1)
let l:tmp3=system("tr -d '\n'", l:tmp2)
return l:tmp3
endfunction
" Define some highlight groups to display nice colors
hi link Base Normal
"hi ColCol ctermbg=235 ctermfg=245
" hi SepCol ctermbg=238 ctermfg=39 cterm=bold gui=bold guibg=#444444 guifg=#00afff
hi FileName ctermfg=208 guifg=#ff8700
hi SepCol ctermfg=39 cterm=bold gui=bold guifg=#00afff
hi GitCol ctermfg=35 guifg=#00af5f
" Create the statusline
set statusline=%#Base#
set statusline+=%#LineNr#
set statusline+=%3c
set statusline+=%#SepCol#%{'\ «\ '}%#FileName#
set statusline+=%t " Filename
set statusline+=%1m " Modified flag
set statusline+=%1r " Read-Only flag
set statusline+=%#SepCol#%{'\ »\ \ \ '}%#Base#
set statusline+=%= " Left - Right separation
set statusline+=%{g:latex_wc} " Latex wordcount
set statusline+=%#SepCol#%{'\ \ \ «\ '}%#Base#
set statusline+=%#GitCol#
set statusline+=\
set statusline+=%{GitBranch(fugitive#head())}
set statusline+=\
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set autoindent "Auto indent
filetype plugin indent on
set wrap "Wrap lines
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with spacebar
nnoremap <space> za
"Let enter make empty line below and shift enter empty line above
map <Enter> o<ESC>
map <S-Enter> O<ESC>
" Let backspace remove indents and eols
set backspace=indent,eol,start
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => YouCompleteMe customization
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Makes the autocomplete window go away after completion
let g:ycm_autoclose_preview_window_after_completion=0
"Makes the autocomplete window go away after exited insert mode
let g:ycm_autoclose_preview_window_after_insertion=1
"Define shorcut for goto definition
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => ALE customization
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <F9> <Plug>(ale_detail)
nmap <leader>n <Plug>(ale_next)
nmap <leader>p <Plug>(ale_previous)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => vim-autopep8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Disable show diff window
let g:autopep8_disabe_show_diff=1
" Map it to the f8 key
augroup Autopep8cmds
autocmd!
autocmd FileType python noremap <buffer> <F8> :call Autopep8()<CR>
augroup END
" Do not format on save
let g:autopep8_on_save = 0