-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
304 lines (266 loc) · 6.29 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
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
set nocompatible " be iMproved
scriptencoding utf-8
set encoding=utf-8
"filetype on " required!
" use files in ~/.vim/after/ftplugin to add
" file type specific settings
set autowrite
" folding
" set nofoldenable
set foldmethod=marker
" filename completion similar to shell
set wildmenu
set wildmode=longest,list
" disable conceal
let g:indentLine_setConceal = 0
" clipboards {{{1
" copy to clipboard
set clipboard=unnamed
set clipboard=unnamedplus
" }}}1
" split {{{1
set splitright
set splitbelow
" }}}1
" directories {{{1
" set swap(.swp), backup(~), undo(.udf) directory to temp
set backupdir=/tmp//
set directory=/tmp//
" }}}1
" keyboard mappings {{{1
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>h
nnoremap <c-h> <c-w>l
nnoremap <c-Down> <c-w>j
nnoremap <c-Up> <c-w>k
nnoremap <c-Left> <c-w>h
nnoremap <c-Right> <c-w>l
" copy paste mappings
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <C-r><C-o>+
" open new terminal at current position
nnoremap ,t :silent :!xterm &<CR>
" map make
nnoremap <F9> :silent make\|redraw!\|cc<CR>
nnoremap <F10> :silent make run\|redraw!\|cc<CR>
nnoremap <F11> :silent make all\|redraw!\|cc<CR>
" }}}1
" vundle {{{1
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
call vundle#end()
" My Bundles here:
" Install with :PluginInstall
" }}}1
" design {{{1
set number
set background=dark
" color {{{2
Plugin 'nanotech/jellybeans.vim'
color jellybeans
" }}}2
" white spaces {{{2
set autoindent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" }}}2
" highlight long lines {{{2
let &colorcolumn=join(range(81,999),",")
let &colorcolumn="80,".join(range(100,999),",")
highlight ColorColumn guibg=#3a3a3a ctermbg=237
" }}}2
" mark white spaces {{{2
set list!
set lcs=tab:\┆\
let g:indentLine_color_term = 237
let g:indentLine_char = '┆'
let g:indentLine_showFirstIndentLevel = 1
let g:indentLine_leadingSpaceEnabled = 1
let g:indentLine_leadingSpaceChar = '·'
" }}}2
" }}}1
" Plugins {{{1
" Style Support {{{2
" table-mode {{{3
Plugin 'dhruvasagar/vim-table-mode'
" }}}3
" i3 {{{3
Plugin 'PotatoesMaster/i3-vim-syntax'
" }}}3
" coloresque {{{3
Plugin 'spacewander/vim-coloresque'
" }}}3
" editorconfig {{{3
Plugin 'editorconfig/editorconfig-vim'
" }}}3
" diff {{{3
Plugin 'chrisbra/vim-diff-enhanced'
" vimdiff enhanced
" started In Diff-Mode set diffexpr (plugin not loaded yet)
if &diff
let &diffexpr='EnhancedDiff#Diff("git diff", "--diff-algorithm=histogram")'
endif
" }}}3
" reStructuredText {{{3
Plugin 'Rykka/riv.vim'
Plugin 'Rykka/InstantRst'
Plugin 'matthew-brett/vim-rst-sections'
Plugin 'nvie/vim-rst-tables'
let g:riv_fold_auto_update = 0
" instant reStructured Text
let g:instant_rst_browser = 'chromium'
autocmd FileType rst nnoremap <F9> :silent InstantRst<CR>
autocmd FileType rst let g:table_mode_corner_corner='+'
autocmd FileType rst let g:table_mode_header_fillchar='='
" }}}3
" markdown {{{3
Plugin 'euclio/vim-markdown-composer'
let g:markdown_composer_autostart = 0
autocmd FileType markdown nnoremap <F9> :silent ComposerStart<CR>
" }}}3
" }}}2
" Linter {{{2
" ALE {{{3
" Plugin 'dense-analysis/ale'
"let g:ale_virtualtext_cursor = 1
"let g:ale_virtualtext_prefix = "ALE> "
" }}}3
" }}}2
" Editor {{{2
" airline {{{3
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" vim airline
set laststatus=2
set ttimeoutlen=50
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'V',
\ 'V' : 'V',
\ '' : 'V',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S',
\ }
let g:airline#extensions#default#section_truncate_width = {}
let g:airline#extensions#wordcount#enabled = 0
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#branch#enabled = 0
" }}}3
" ctrlp {{{3
Plugin 'ctrlpvim/ctrlp.vim'
" CtrlP settings
let g:ctrlp_by_filename = 1
let g:ctrlp_match_window = 'results:100' " overcome limit imposed by max height
let g:ctrlp_root_markers = ['.ctrlp']
" }}}3
" surround {{{3
Plugin 'tpope/vim-surround'
" }}}3
" vifm {{{3
Plugin 'vifm/neovim-vifm'
" }}}3
" Context {{{3
Plugin 'wellle/context.vim'
let g:context_enabled = 1
let g:context_nvim_no_redraw = 1
" }}}3
" }}}2
" Other {{{2
" cheat.sh {{{3
Plugin 'dbeniamine/cheat.sh-vim'
" }}}3
" unimpaired {{{3
Plugin 'tpope/vim-unimpaired'
" }}}3
" indentLine {{{3
Plugin 'Yggdroot/indentLine'
" }}}3
" fugitive {{{3
Plugin 'tpope/vim-fugitive'
" }}}3
" repeat {{{3
Plugin 'tpope/vim-repeat'
" }}}3
" {{{3 fetch
Plugin 'kopischke/vim-fetch'
" }}}3
" }}}2
" Scripts {{{2
" Preserve {{{3
" Restore cursor position, window position, and last search after running a
" command.
function! Preserve(command)
" Save the last search.
let search = @/
" Save the current cursor position.
let cursor_position = getpos('.')
" Save the current window position.
normal! H
let window_position = getpos('.')
call setpos('.', cursor_position)
" Execute the command.
execute a:command
" Restore the last search.
let @/ = search
" Restore the previous window position.
call setpos('.', window_position)
normal! zt
" Restore the previous cursor position.
call setpos('.', cursor_position)
endfunction
" }}}3
" remove trailing whitespaces {{{3
fun! StripTrailingWhitespace()
" Only strip if the b:noStripWhitespace variable isn't set
if exists('b:noStripWhitespace')
return
endif
call Preserve(':%s/\s\+$//e')
endfun
" Re-format the whole buffer.
function! Format()
" Only strip if the b:autoformat is 1
if exists('b:autoformat') && b:autoformat == 1
call Preserve('normal gggqG')
endif
endfunction
autocmd BufWritePre * call StripTrailingWhitespace()
autocmd BufWritePre * call Format()
" }}}3
" }}}2
" }}}1
" COC {{{1
Plugin 'neoclide/coc.nvim'
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-diagnostic',
\ 'coc-json',
\ 'coc-git',
\ 'coc-jedi',
\ 'coc-yaml',
\ 'coc-sh',
\ 'coc-go'
\ ]
inoremap <silent><expr> <c-space> coc#refresh()
nmap <silent> <c-j> :call CocAction('diagnosticNext')<cr>
nmap <silent> <c-k> :call CocAction('diagnosticPrevious')<cr>
" }}}1
"{{{1 Terminal
tnoremap <Esc><Esc> <C-\><C-n>
"}}}
let g:python3_host_prog = '/usr/bin/python3'
syntax on
filetype plugin indent on