Skip to content

Instantly share code, notes, and snippets.

@chtenb
Created June 8, 2016 10:04
Show Gist options
  • Save chtenb/0c804418d32745f5e088edc093bc104e to your computer and use it in GitHub Desktop.
Save chtenb/0c804418d32745f5e088edc093bc104e to your computer and use it in GitHub Desktop.
import re
from shellout import get, out
errors = get('cat errors.txt')
# Fix missing explicit keyword using vim
# Where explicit.vim contains:
# exe "normal 0wiexplicit \<esc>"
# wq
try:
regex = re.compile(r'\[(?P<filename>[^:]+):(?P<linenumber>\d+)')
matches = regex.findall(errors)
for match in matches:
d = match.groupdict()
filename = d['filename']
linenumber = d['linenumber']
print(filename, linenumber)
out(r'vim -T dumb -N -u NONE +{} -c "set nomore" -S explicit.vim "{}"',
linenumber, filename, verbose=True)
finally:
out('clear')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment