gvim-wrapper/gvim-wrapper.py
2012-10-19 14:07:55 -04:00

33 lines
967 B
Python

import os
import sys
config = {
'vimdir': 'C:\\apps\\Vim\\vim73'
}
def read_config_file(config, path):
if os.path.exists(path):
fh = open(path, 'r')
script = fh.read()
fh.close()
try:
exec(script, config)
except:
sys.stderr.write('Configuration file error in "%s":\n' % path)
traceback.print_exception(sys.exc_info()[0], sys.exc_info()[1],
None)
tb = traceback.extract_tb(sys.exc_info()[2])
for ent in tb[1:]:
lineno, fn = ent[1:3]
sys.stderr.write(' File "%s", line %d, in %s\n'
% (path, lineno, fn))
def main(argv):
if (len(argv) < 2):
return -1
read_config_file(config, os.path.expanduser('~/.gvim-wrapper'))
os.execv(config['vimdir'] + '\\gvim.exe', ['gvim', '--remote-tab-silent'] + argv[1:])
if __name__ == '__main__':
sys.exit(main(sys.argv))