Просмотр исходного кода

Add configuration to whitespace deletion

Andrew Swistak 8 лет назад
Родитель
Сommit
dddac3e89f
1 измененных файлов с 7 добавлено и 5 удалено
  1. 7 5
      vimrc

+ 7 - 5
vimrc

@@ -325,12 +325,14 @@ colors monokai
 
 " Delete trailing whitespaces on saving.
 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
-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.
 let c='a'