commit f1a298d36c83b9d0e9fde072db88c0be314bcb31 (patch)
parent a5ea61f2964a77e676c44a85cc148b9ded59a9e9
Author: Alex Karle <alex@alexkarle.com>
Date: Fri, 2 Jul 2021 23:28:01 -0400
vim: Remove function from vimcasts.org
I'm on a mission to one day release my dotfiles under a FOSS license.
Before that can happen, I want to make sure the code is all mine!
Diffstat:
2 files changed, 1 insertion(+), 15 deletions(-)
diff --git a/.vim/autoload/vimrc.vim b/.vim/autoload/vimrc.vim
@@ -12,17 +12,3 @@ function! vimrc#ToggleColorColumn() abort
set colorcolumn=""
endif
endfunction
-
-" A function to execute a command and return to the old position
-" CREDIT: http://vimcasts.org/episodes/tidying-whitespace/
-function! vimrc#CMDPreserve(command) abort
- " Preparation: save last search, and cursor position.
- let _s=@/
- let l = line(".")
- let c = col(".")
- " Do the business:
- execute a:command
- " Clean up: restore previous search history, and cursor position
- let @/=_s
- call cursor(l, c)
-endfunction
diff --git a/.vim/improved.vim b/.vim/improved.vim
@@ -94,7 +94,7 @@ nnoremap <C-l> <C-w>l
nnoremap <C-p> :set paste \| put + \| set nopaste<CR>
" Clear trailing whitespace (through regexp)
-nnoremap <leader><space> :call vimrc#CMDPreserve("%s/\\s\\+$//e")<CR>
+nnoremap <leader><space> :%s/\s\+$//e<CR>
" edit in current buffer dir
nnoremap <leader>e :e %:h/