-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·314 lines (243 loc) · 7.44 KB
/
vimrc
File metadata and controls
executable file
·314 lines (243 loc) · 7.44 KB
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
305
306
307
308
309
310
311
312
313
call plug#begin('~/.vim/plugged')
Plug 'bronson/vim-trailing-whitespace'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'junegunn/vim-easy-align'
Plug 'Lokaltog/vim-easymotion'
Plug 'luochen1990/rainbow'
Plug 'MarcWeber/vim-addon-local-vimrc'
Plug 'mhinz/vim-startify'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'sheerun/vim-polyglot'
Plug 'tmhedberg/matchit'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'metakirby5/codi.vim' " Scratchpad :Codi
Plug 'wellle/targets.vim' " Improved ca( ciw... etc
Plug 'mhinz/vim-signify' " show vcs diff in gutter
Plug 'farmergreg/vim-lastplace' " reopens files to last position
Plug 'ConradIrwin/vim-bracketed-paste' " auto :set paste
" Plug 'w0rp/ale'
" Plug 'prettier/vim-prettier'
call plug#end()
" theme
syntax enable
set background=dark
colorscheme agscala
let g:airline_theme='light'
let g:airline_powerline_fonts=1
let &t_SI.="\e[5 q"
let &t_SR.="\e[4 q"
let &t_EI.="\e[1 q"
set linespace=1
set cmdheight=1
set signcolumn=yes
set backspace=indent,eol,start
set cursorcolumn
set cursorline
set encoding=utf-8
set fileformats=unix,dos,mac
set hidden
set laststatus=2
set lazyredraw
set magic
set nocompatible
set number
set ruler
set scrolloff=3
set shortmess=a
set showcmd
set showmode
set sidescroll=1
set sidescrolloff=10
set splitbelow
set splitright
set ttyfast
set wildignore=*.o,*~,*.pyc,*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
set wildmenu
set wildmode=list:longest
set list
set listchars=tab:»\ ,trail:·
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" " indentation
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set smartindent
set expandtab
set smarttab
set shiftround
filetype indent plugin on
syntax on
" searching
set ignorecase
set smartcase
set incsearch
set showmatch
set nohlsearch
nnoremap j gj
nnoremap k gk
"reindent text after p
nnoremap p p=`]
" CoC - Conquer of Completion
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" Rainbow Parenthesis:
let g:rainbow_active = 1
" Print out the syntax groups under the cursor for debugging colorschemes
map <F12> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
" Reselect visual block after indent
vnoremap < <gv
vnoremap > >gv
" Don't save deleted text
vnoremap p "_dP
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
let g:easy_align_ignore_groups = []
"let g:easy_align_ignore_groups = ['Comment', 'String']
let mapleader = ","
" Show Git Diff in window split when committing
autocmd FileType gitcommit silent DiffGitCached | wincmd p | :resize 15
" Fold toggling with <Space> if a fold exists at the cursor.
nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
vnoremap <Space> zf
" 256 Color support in the terminal
set t_Co=256
" Enter inserts inserts blank lines without entering insert mode.
nmap [<space> O<Esc>
nmap ]<space> o<Esc>
" Map ctrl-movement keys to window switching & resizing
noremap <C-k> <C-w><Up>
noremap <C-j> <C-w><Down>
noremap <C-l> <C-w><Right>
noremap <C-h> <C-w><Left>
" Fix [<section> commands so that it matches both formats of function braces
map [[ ?{<CR>w99[{
map ][ /}<CR>b99]}
map ]] j0[[%/{<CR>
map [] k$][%?}<CR>
" NERDTree
imap <F8> <Esc>:NERDTreeToggle<CR>
nmap <F8> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.pyc$']
" Run the script based on the filetype with <F5>
map <F5> <Esc>:Codi!!<CR>
" Show trailing whitepace and spaces before a tab:
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
" Shortcut to sudo write a file
cmap w!! %!sudo tee > /dev/null %
" Remove GUI from GVIM
set guioptions=
" AckGrep.vim
" let g:ackprg="ack-grep -H --nocolor --nogroup "
let g:ackprg="ack-grep -H"
" NERD_Commenter.vim settings
let NERDSpaceDelims = 1
let NERDCompactSexyComs = 1
" Startify.vim settings
let g:startify_change_to_dir = 0
autocmd FileType startify setlocal buftype=
" EasyMotion.vim settings
" let g:EasyMotion_leader_key = '<Leader>'
""" Powerline.vim
" let g:Powerline_symbols = 'fancy'
""" CommandT.vim
map <F6> <Esc>:CommandT<CR>
nnoremap <silent> <Leader>b :CommandTBuffer<CR>
""" Supertab.vim
" let g:SuperTabDefaultCompletionType = "context"
""" MRU (Most Recently Used)
map <F9> <Esc>:CtrlPMRUFiles<CR>
map <C-@> <Esc>:CtrlP<CR>
" map <F9> <Esc>:MRU<CR>
" let MRU_Max_Menu_Entries = 20
"
" Backups
" set backup
" set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" set backupskip=/tmp/*,/private/tmp/*
" set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" set writebackup
set nobackup
set writebackup
set noswapfile
nnoremap q: <nop>
nnoremap Q <nop>
"========= VIM DIFF ========="
function! s:DiffAllWindows(on) " {{{2
windo call <SID>DiffThisWindow(a:on)
endfunc
function! s:DiffThisWindow(on) " {{{2
if a:on
silent! set diff scrollbind fdm=diff
else
silent! set nodiff noscrollbind fdm=syntax
end
endfunc
function! s:DiffThese(file1, file2) " {{{2
exe "tabedit " . a:file1
exe "vsplit " . a:file2
call <SID>DiffAllWindows(1)
endfunc
command! -nargs=0 DiffThis call <SID>DiffThisWindow(1)
command! -nargs=0 DiffOff call <SID>DiffThisWindow(0)
command! -nargs=0 DiffToggle call <SID>DiffThisWindow(!&diff)
command! -nargs=0 DiffAll call <SID>DiffAllWindows(1)
command! -nargs=0 DiffAllOff call <SID>DiffAllWindows(0)
command! -nargs=* -complete=file DiffThese call <SID>DiffThese(<f-args>)
"====== END VIM DIFF ========
" signify
set updatetime=100
let g:coc_global_extensions = ['coc-elixir', 'coc-diagnostic']