mirror of
https://github.com/mhinz/neovim-remote
synced 2024-11-11 13:10:34 +00:00
Implement --servername
This commit is contained in:
parent
7876412c3d
commit
8cb27c38de
@ -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)
|
||||||
|
|
||||||
|
|
||||||
@ -59,33 +59,36 @@ def parse_args():
|
|||||||
parser = argparse.ArgumentParser(usage=usage, description=desc, epilog=epilog)
|
parser = argparse.ArgumentParser(usage=usage, description=desc, epilog=epilog)
|
||||||
|
|
||||||
parser.add_argument('--remote',
|
parser.add_argument('--remote',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='<file>',
|
metavar='<file>',
|
||||||
help='open file in new buffer [ASYNC]')
|
help='open file in new buffer [ASYNC]')
|
||||||
parser.add_argument('--remote-wait',
|
parser.add_argument('--remote-wait',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='<file>',
|
metavar='<file>',
|
||||||
help='as --remote [SYNC]')
|
help='as --remote [SYNC]')
|
||||||
parser.add_argument('--remote-silent',
|
parser.add_argument('--remote-silent',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='<file>',
|
metavar='<file>',
|
||||||
help="as --remote, but don't throw error if no server is found [ASYNC]")
|
help="as --remote, but don't throw error if no server is found [ASYNC]")
|
||||||
parser.add_argument('--remote-wait-silent',
|
parser.add_argument('--remote-wait-silent',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='<file>',
|
metavar='<file>',
|
||||||
help="as --remote, but don't throw error if no server is found [SYNC]")
|
help="as --remote, but don't throw error if no server is found [SYNC]")
|
||||||
parser.add_argument('--remote-tab',
|
parser.add_argument('--remote-tab',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='<file>',
|
metavar='<file>',
|
||||||
help='open file in new tab [SYNC]')
|
help='open file in new tab [SYNC]')
|
||||||
parser.add_argument('--remote-send',
|
parser.add_argument('--remote-send',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='<keys>',
|
metavar='<keys>',
|
||||||
help='send keys to server [SYNC]')
|
help='send keys to server [SYNC]')
|
||||||
parser.add_argument('--remote-expr',
|
parser.add_argument('--remote-expr',
|
||||||
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,9 +96,12 @@ def parse_args():
|
|||||||
def main():
|
def main():
|
||||||
args, unused = parse_args()
|
args, unused = parse_args()
|
||||||
|
|
||||||
sockpath = os.environ.get('NVIM_LISTEN_ADDRESS')
|
if args.servername:
|
||||||
if sockpath is None:
|
sockpath = args.servername
|
||||||
sockpath = '/tmp/nvimsocket'
|
else:
|
||||||
|
sockpath = os.environ.get('NVIM_LISTEN_ADDRESS')
|
||||||
|
if sockpath is None:
|
||||||
|
sockpath = '/tmp/nvimsocket'
|
||||||
|
|
||||||
n = Neovim(sockpath)
|
n = Neovim(sockpath)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user