Skip to content

Instantly share code, notes, and snippets.

@drobati
Created January 14, 2016 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drobati/cefbdd182e940d313a46 to your computer and use it in GitHub Desktop.
Save drobati/cefbdd182e940d313a46 to your computer and use it in GitHub Desktop.
Strip trailing whitespace
" Strip trailing whitespace (,ss)
function! StripWhitespace()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
noremap <leader>ss :call StripWhitespace()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment