1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-06 21:45:10 +01:00

Useful :TrimWhitespace command to trim trailing spaces and such

This commit is contained in:
2020-02-11 15:22:25 +01:00
parent aac84dffbc
commit cf5886795f

8
.vimrc
View File

@@ -498,6 +498,14 @@ set listchars=tab:▸\ ,trail:·
" Display whitespace " Display whitespace
set list set list
" Trim trailing whitespace with :TrimWhitespace
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
command! TrimWhitespace call TrimWhitespace()
" enable words completion " enable words completion
set dictionary+=/usr/share/dict/words set dictionary+=/usr/share/dict/words
" use ctrl-n ctrl-n instead of ctrl-x ctrl-k " use ctrl-n ctrl-n instead of ctrl-x ctrl-k