2
0
mirror of https://github.com/mhinz/neovim-remote synced 2024-11-11 13:10:34 +00:00

Implement --servername

This commit is contained in:
Marco Hinz 2015-12-04 15:45:59 +01:00
parent 7876412c3d
commit 8cb27c38de

View File

@ -48,7 +48,7 @@ class Neovim():
if silent: if silent:
return False return False
else: else:
print("Can't find unix socket {}. Set NVIM_LISTEN_ADDRESS.".format(self.sockpath)) print("Can't find unix socket {}. Export $NVIM_LISTEN_ADDRESS or use --servername.".format(self.sockpath))
sys.exit(1) sys.exit(1)
@ -86,6 +86,9 @@ def parse_args():
action='append', action='append',
metavar='<expr>', metavar='<expr>',
help='evaluate expression and print result [SYNC]') help='evaluate expression and print result [SYNC]')
parser.add_argument('--servername',
metavar='<sock>',
help='path to unix socket (overrides $NVIM_LISTEN_ADDRESS)')
return parser.parse_known_args() return parser.parse_known_args()
@ -93,6 +96,9 @@ def parse_args():
def main(): def main():
args, unused = parse_args() args, unused = parse_args()
if args.servername:
sockpath = args.servername
else:
sockpath = os.environ.get('NVIM_LISTEN_ADDRESS') sockpath = os.environ.get('NVIM_LISTEN_ADDRESS')
if sockpath is None: if sockpath is None:
sockpath = '/tmp/nvimsocket' sockpath = '/tmp/nvimsocket'