From efd4ab0f0c6ff8950c2ab59833ae1545b7c30bf0 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 7 Oct 2021 12:28:40 -0700 Subject: [PATCH] lift some handy vim functions --- home/vimrc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/home/vimrc b/home/vimrc index c35be80..895a8ec 100644 --- a/home/vimrc +++ b/home/vimrc @@ -119,7 +119,24 @@ endif let $PATH .= ':'.$HOME.'/sh' " allow direct invocation of shell funcs -" autocmd {{{1 +" fun {{{1 + +" lifted from BurntSushi: +fu! GlobalReplace() + normal! gv"ry + let replacement = input("Replace " . @r . " with: ") + if replacement != "" + exe "%s/" . @r . "/" . replacement . "/g" + endif +endf + +" lifted from BurntSushi: +fu! StripTrailingWhitespace() + let l = line(".") + let c = col(".") + %s/\s\+$//e + call cursor(l, c) +endf fu! TabEight() setlocal tabstop=8 shiftwidth=8 noexpandtab softtabstop=0