mirror of
https://github.com/mhinz/neovim-remote
synced 2024-11-11 13:10:34 +00:00
Use absolute file paths for opening files
Otherwise, filenames are interpreted as relative to neovim's cwd, which is not necessarily that of the shell executing nvr.
This commit is contained in:
parent
d206e65548
commit
a308d2d0c0
18
nvr
18
nvr
@ -129,6 +129,8 @@ def parse_args():
|
|||||||
|
|
||||||
return parser.parse_known_args()
|
return parser.parse_known_args()
|
||||||
|
|
||||||
|
def prepare_filename(fname):
|
||||||
|
return os.path.abspath(fname).replace(" ", "\ ")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args, unused = parse_args()
|
args, unused = parse_args()
|
||||||
@ -151,27 +153,27 @@ def main():
|
|||||||
|
|
||||||
if unused and n.attached(silent=True):
|
if unused and n.attached(silent=True):
|
||||||
for fname in unused:
|
for fname in unused:
|
||||||
n.server.command('edit {}'.format(fname.replace(" ", "\ ")), async=True)
|
n.server.command('edit {}'.format(prepare_filename(fname)), async=True)
|
||||||
|
|
||||||
if args.remote_silent and n.attached(silent=True):
|
if args.remote_silent and n.attached(silent=True):
|
||||||
for fname in args.remote_silent:
|
for fname in args.remote_silent:
|
||||||
n.server.command('edit {}'.format(fname.replace(" ", "\ ")), async=True)
|
n.server.command('edit {}'.format(prepare_filename(fname)), async=True)
|
||||||
|
|
||||||
if args.remote_wait_silent and n.attached(silent=True):
|
if args.remote_wait_silent and n.attached(silent=True):
|
||||||
for fname in args.remote_wait_silent:
|
for fname in args.remote_wait_silent:
|
||||||
n.server.command('edit {}'.format(fname.replace(" ", "\ ")))
|
n.server.command('edit {}'.format(prepare_filename(fname)))
|
||||||
|
|
||||||
if args.remote and n.attached():
|
if args.remote and n.attached():
|
||||||
for fname in args.remote:
|
for fname in args.remote:
|
||||||
n.server.command('edit {}'.format(fname.replace(" ", "\ ")), async=True)
|
n.server.command('edit {}'.format(prepare_filename(fname)), async=True)
|
||||||
|
|
||||||
if args.remote_wait and n.attached():
|
if args.remote_wait and n.attached():
|
||||||
for fname in args.remote_wait:
|
for fname in args.remote_wait:
|
||||||
n.server.command('edit {}'.format(fname.replace(" ", "\ ")))
|
n.server.command('edit {}'.format(prepare_filename(fname)))
|
||||||
|
|
||||||
if args.remote_tab and n.attached():
|
if args.remote_tab and n.attached():
|
||||||
for fname in args.remote_tab:
|
for fname in args.remote_tab:
|
||||||
n.server.command('tabedit {}'.format(fname.replace(" ", "\ ")))
|
n.server.command('tabedit {}'.format(prepare_filename(fname)))
|
||||||
|
|
||||||
if args.remote_send and n.attached():
|
if args.remote_send and n.attached():
|
||||||
for keys in args.remote_send:
|
for keys in args.remote_send:
|
||||||
@ -196,11 +198,11 @@ def main():
|
|||||||
|
|
||||||
if args.o and n.attached():
|
if args.o and n.attached():
|
||||||
for fname in args.o:
|
for fname in args.o:
|
||||||
n.server.command('split {}'.format(fname.replace(" ", "\ ")), async=True)
|
n.server.command('split {}'.format(prepare_filename(fname)), async=True)
|
||||||
|
|
||||||
if args.O and n.attached():
|
if args.O and n.attached():
|
||||||
for fname in args.O:
|
for fname in args.O:
|
||||||
n.server.command('vsplit {}'.format(fname.replace(" ", "\ ")), async=True)
|
n.server.command('vsplit {}'.format(prepare_filename(fname)), async=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user