[vimrc] Disable trailing whitespace cleanup when in binary mode

This commit is contained in:
lhark 2018-02-26 03:13:20 -05:00
parent 5c1c64d373
commit b2190f6cb3

10
vimrc
View file

@ -94,7 +94,8 @@ if has("unix") || has("mac")
\ 'component_expand': {
\ 'linter_warnings': 'LightlineLinterWarnings',
\ 'linter_errors': 'LightlineLinterErrors',
\ 'linter_ok': 'LightlineLinterOK'
\ 'linter_ok': 'LightlineLinterOK',
\ 'lineinfo': 'LineInfo'
\ },
\ 'component_type': {
\ 'readonly': 'error',
@ -467,7 +468,8 @@ function! DeleteTrailingTWS()
silent %s/\s\+$//ge
normal 'b
endfunction
if has("autocmd")
"[Do not clean up trailing spaces in binary mode]"
if has("autocmd") && !&binary
autocmd BufWritePre *.py,*.pyw retab
autocmd BufWritePre * call DeleteTrailingTWS()
endif
@ -502,6 +504,10 @@ function! LightlineLinterOK() abort
return l:counts.total == 0 ? '✓ ' : ''
endfunction
function! LineInfo()
return !&binary ? '%3l:%-2v' : '%3l:%-2v off:%o,0x%O'
endfunction
autocmd User ALELint call s:MaybeUpdateLightline()
" Update and show lightline but only if it's visible (e.g., not in Goyo)