-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
37 lines (30 loc) · 849 Bytes
/
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
function! s:SourceConfigFilesIn(directory)
let directory_splat = '~/.vim/' . a:directory . '/*.vim'
for config_file in split(glob(directory_splat), '\n')
if filereadable(config_file)
execute 'source' config_file
endif
endfor
endfunction
call plug#begin('~/.vim/plugged')
call s:SourceConfigFilesIn('plugins')
call plug#end()
call s:SourceConfigFilesIn('config')
command! ClearWhitespace call s:ClearWhitespace()
function! s:ClearWhitespace()
let l:line = line('.')
let l:column = col('.')
keepjumps silent! %s/\s\+$//e
call cursor(l:line, l:column)
call histdel("search", -1)
endfunction
function! s:ClearWhitespaceIfExpected()
if &ft =~? 'markdown'
return
endif
call s:ClearWhitespace()
endfunction
augroup ft_settings
autocmd!
autocmd BufWritePre * call s:ClearWhitespaceIfExpected()
augroup END