Преглед изворни кода

Add configuration to whitespace deletion

Andrew Swistak пре 8 година
родитељ
комит
dddac3e89f
1 измењених фајлова са 7 додато и 5 уклоњено
  1. 7 5
      vimrc

+ 7 - 5
vimrc

@@ -325,12 +325,14 @@ colors monokai
 
 
 " Delete trailing whitespaces on saving.
 " Delete trailing whitespaces on saving.
 function! DeleteTrailingWS()
 function! DeleteTrailingWS()
-  exe "normal mz"
-  %s/\s\+$//ge
-  exe "normal `z"
+  if !exists('b:noStrip')
+    exe "normal mz"
+    %s/\s\+$//ge
+    exe "normal `z"
+  endif
 endfunction
 endfunction
-autocmd BufWrite * :call DeleteTrailingWS()
-autocmd BufWrite *.go :GoImports
+au BufWrite * :call DeleteTrailingWS()
+au FileType go let b:noStrip=1
 
 
 " Allow the use of ALT as a function key.
 " Allow the use of ALT as a function key.
 let c='a'
 let c='a'