Skip to content

Instantly share code, notes, and snippets.

/conner.vim Secret

Created October 19, 2012 11:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8384390ef05b751c26b8 to your computer and use it in GitHub Desktop.
Save anonymous/8384390ef05b751c26b8 to your computer and use it in GitHub Desktop.
command! -nargs=* -range=% G <line1>,<line2>call MultiG(<f-args>)
fun! MultiG(...) range
let pattern = ""
let command = ""
for i in a:000
if i[0] == "-"
let pattern .= "\\(.*".strpart(i,1)."\\)\\@!"
elseif i[0] == "+"
let pattern .= "\\(.*".strpart(i,1)."\\)\\@="
else
let command = i
endif
endfor
exe a:firstline.",".a:lastline."g/".pattern."/".command
endfun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment