def _vim(fname, globs):
    sh('vim ' + fname)
dirname, _, basename = fname.rpartition('/')
modname = basename.rpartition('.')[0]
m = imp.load_source(modname, fname)
globs[modname] = m
Как запустить Vim в интерпретаторе Python?