nvim: plugin: Add a simple whitespace plugin
Now that we dropped vim-better-whitespace just add something simple to strip whitespace if we do ever need it.
This commit is contained in:
parent
8a43a1c14f
commit
891fae907b
1 changed files with 12 additions and 0 deletions
12
nvim/.config/nvim/plugin/whitespace.vim
Normal file
12
nvim/.config/nvim/plugin/whitespace.vim
Normal file
|
@ -0,0 +1,12 @@
|
|||
" https://vi.stackexchange.com/questions/454/whats-the-simplest-way-to-strip-trailing-whitespace-from-all-lines-in-a-file
|
||||
function! Preserve(command)
|
||||
" Preparation: save window state
|
||||
let l:saved_winview = winsaveview()
|
||||
" Run the command:
|
||||
execute a:command
|
||||
" Clean up: restore previous window position
|
||||
call winrestview(l:saved_winview)
|
||||
endfunction
|
||||
|
||||
nnoremap <unique> <silent> <Leader>ws :call Preserve("%s/\\s\\+$//e")<CR>
|
||||
xnoremap <unique> <silent> <Leader>ws :call Preserve("%s/\\s\\+$//e")<CR>
|
Loading…
Reference in a new issue