:'<,'>! ./example.py
#!/bin/env python3
#:'<,'>! ./example.py # ← this is how to use it
import sys
data = sys.stdin.readlines()
for l in data:
l = l.replace("a", "e").rstrip()
print(l)
I also use vim, and I use it a bit to edit my beancount files, but I mostly use fava, a most excellent web interface for beancount. In addition to having a built in editor (which does formatting and can catch errors and show you exactly where they are), it allows you to quickly add new transactions based on old ones — the dialog box allows you to choose from previously used accounts to speed up input. It’s a lifesaver. I don’t think I would have continued using beancount long term if it wasn’t for fava.
Just about the only negative thing I can say about fava is that it does formatting slightly differently from bean-format. I actually prefer it to beancount, but there are some cases where I prefer the native formatting (like when declaring/opening accounts). So for some months, I will switch from one to another. A minor nitpick, but it’s slightly annoying.