소스 검색

Add configuration to whitespace deletion

Andrew Swistak 8 년 전
부모
커밋
25e79c8feb
1개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  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.