Browse Source

Add configuration to whitespace deletion

Andrew Swistak 8 năm trước cách đây
mục cha
commit
25e79c8feb
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      vimrc

+ 7 - 5
vimrc

@@ -326,12 +326,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
 
 if !has("nvim")
   " Allow the use of ALT as a function key.