diff options
Diffstat (limited to '.config/nvim/general/functions.vim')
| -rw-r--r-- | .config/nvim/general/functions.vim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/.config/nvim/general/functions.vim b/.config/nvim/general/functions.vim new file mode 100644 index 0000000..07a67c4 --- /dev/null +++ b/.config/nvim/general/functions.vim @@ -0,0 +1,12 @@ +function! <SID>StripTrailingWhitespaces() + " Preparation: save last search, and cursor position. + let _s=@/ + let l = line(".") + let c = col(".") + " Do the business: + %s/\s\+$//e + " Clean up: restore previous search history, and cursor position + let @/=_s + call cursor(l, c) +endfunction +nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR> |
