Skip to content

Commit

Permalink
vimrc: add StripTrailingWhitespace function.
Browse files Browse the repository at this point in the history
Signed-off-by: lilei (Cloud) <[email protected]>
  • Loading branch information
lilei (Cloud) authored and lilei (Cloud) committed Sep 5, 2018
1 parent fda5674 commit 6cc6830
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ let NERDTreeShowBookmarks=1
let NERDTreeWinPos = "right"
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

" remove unwanted whitespace
" However, this has minor side-effects, such as influencing undo history
" and sometimes changing scroll position.
" http://vim.wikia.com/wiki/Remove_unwanted_spaces
function StripTrailingWhitespace()
if !&binary && &filetype != 'diff'
normal mz
normal Hmy
%s/\s\+$//e
normal 'yz<CR>
normal `z
endif
endfunction

" keybindings for plugin toggle
nmap <F6> :NERDTreeToggle<cr>
Expand Down

0 comments on commit 6cc6830

Please sign in to comment.