From b2190f6cb314960b06ed1531beada2d73dc648cd Mon Sep 17 00:00:00 2001 From: lhark Date: Mon, 26 Feb 2018 03:13:20 -0500 Subject: [PATCH] [vimrc] Disable trailing whitespace cleanup when in binary mode --- vimrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index f6f4d0c..d25e71c 100644 --- a/vimrc +++ b/vimrc @@ -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)