Strip trailing whitespaces

0 Points

Alex Alex

2 months 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 2 months ago

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