handle multiple filename arguments
This commit is contained in:
parent
f7784fc76a
commit
cae6118e1d
@ -2,7 +2,12 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
'vimdir': 'C:\\apps\\Vim\\vim73'
|
# path to directory containing vim.exe and gvim.exe
|
||||||
|
'vimdir': 'C:\\apps\\Vim\\vim73',
|
||||||
|
# list of (name, path) tuples defining gvim contexts
|
||||||
|
'servers': [],
|
||||||
|
# default server name to use if no server paths match
|
||||||
|
'default_server': 'GVIM',
|
||||||
}
|
}
|
||||||
|
|
||||||
def read_config_file(config, path):
|
def read_config_file(config, path):
|
||||||
@ -22,11 +27,17 @@ def read_config_file(config, path):
|
|||||||
sys.stderr.write(' File "%s", line %d, in %s\n'
|
sys.stderr.write(' File "%s", line %d, in %s\n'
|
||||||
% (path, lineno, fn))
|
% (path, lineno, fn))
|
||||||
|
|
||||||
|
def get_server_name(config, fname):
|
||||||
|
return config['default_server']
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
if (len(argv) < 2):
|
if (len(argv) < 2):
|
||||||
return -1
|
return -1
|
||||||
read_config_file(config, os.path.expanduser('~/.gvim-wrapper'))
|
read_config_file(config, os.path.expanduser('~/.gvim-wrapper'))
|
||||||
os.execv(config['vimdir'] + '\\gvim.exe', ['gvim', '--remote-tab-silent'] + argv[1:])
|
for fname in argv[1:]:
|
||||||
|
servername = get_server_name(config, fname)
|
||||||
|
os.execv(config['vimdir'] + '\\gvim.exe',
|
||||||
|
['gvim', '--servername', servername, '--remote-tab-silent', fname])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main(sys.argv))
|
sys.exit(main(sys.argv))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user