diff options
Diffstat (limited to 'vim.dot.link/plugin/lib.vim')
-rw-r--r-- | vim.dot.link/plugin/lib.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vim.dot.link/plugin/lib.vim b/vim.dot.link/plugin/lib.vim index 0e4cafa..9e7b689 100644 --- a/vim.dot.link/plugin/lib.vim +++ b/vim.dot.link/plugin/lib.vim @@ -19,3 +19,14 @@ " call setline('.', substitute(line, '- ', '- \[ \] ', '')) " endif "endf + +" Remove trailing spaces +" +" Thanks https://vi.stackexchange.com/a/456 +fun! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun + +command! TrimWhitespace call TrimWhitespace() |