Skip to content

Instantly share code, notes, and snippets.

@yyq123
Created June 8, 2017 08:41
Show Gist options
  • Save yyq123/e1abcf60f06f92a74995b4c481530f27 to your computer and use it in GitHub Desktop.
Save yyq123/e1abcf60f06f92a74995b4c481530f27 to your computer and use it in GitHub Desktop.
function DeAmperfyAll() range"Step through each line in the range...
for linenum in range(a:firstline, a:lastline)
"Replace loose ampersands (as in DeAmperfy())...
let curr_line = getline(linenum)
let replacement = substitute(curr_line,'&\(\w\+;\)\@!','&','g')
call setline(linenum, replacement)
endfor
"Report what was done...
if a:lastline > a:firstline
echo "DeAmperfied" (a:lastline - a:firstline + 1) "lines"
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment