Strip trailing whitespaces

0 Points

Alex Alex

5 years ago

Quick and handy way to get rid of the spaces at the end of the lines.

nnoremap <silent><leader>f4 :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>

Enan Ajmain

Enan Ajmain 5 years ago

Should use :h winsave() and :h winrestview() to restore cursor position.