瀏覽代碼

Don't add trailing whitespace to search history

Andrew Swistak 5 年之前
父節點
當前提交
9f4d732004
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      vimrc

+ 2 - 2
vimrc

@@ -401,11 +401,11 @@ hi MatchParen ctermfg=160 ctermbg=NONE cterm=underline guifg=#df0000 guibg=NONE
 function! DeleteTrailingWS()
   if !exists('b:noStrip')
     exe "normal mz"
-    %s/\s\+$//ge
+    keepp %s/\s\+$//ge
     exe "normal `z"
   endif
 endfunction
-au BufWrite * :call DeleteTrailingWS()
+au BufWritePre * :call DeleteTrailingWS()
 au FileType go let b:noStrip=1
 
 if !has("nvim")