mirror of
https://github.com/mhinz/neovim-remote
synced 2024-11-11 13:10:34 +00:00
Make "-o -" and "-O -" read from STDIN
References https://github.com/mhinz/neovim-remote/issues/28
This commit is contained in:
parent
a435992e1f
commit
3a93776ec3
17
bin/nvr
17
bin/nvr
@ -56,6 +56,13 @@ class Neovim():
|
||||
self._msg_shown = True
|
||||
return False
|
||||
|
||||
def read_stdin_into_buffer(self, cmd):
|
||||
self.server.command(cmd)
|
||||
for line in sys.stdin:
|
||||
self.server.command("call append('$', '{}')".
|
||||
format(line.rstrip().replace("'", "''")))
|
||||
self.server.command('silent 1delete _')
|
||||
|
||||
def execute(self, arguments, cmd='edit', silent=False, wait=False):
|
||||
if self.is_attached(silent):
|
||||
self._execute_remotely(arguments, cmd, wait)
|
||||
@ -298,10 +305,16 @@ def main():
|
||||
|
||||
if flags.o and neovim.is_attached():
|
||||
for fname in flags.o:
|
||||
neovim.server.command('split {}'.format(prepare_filename(fname)))
|
||||
if fname == '-':
|
||||
neovim.read_stdin_into_buffer('new')
|
||||
else:
|
||||
neovim.server.command('split {}'.format(prepare_filename(fname)))
|
||||
if flags.O and neovim.is_attached():
|
||||
for fname in flags.O:
|
||||
neovim.server.command('vsplit {}'.format(prepare_filename(fname)))
|
||||
if fname == '-':
|
||||
neovim.read_stdin_into_buffer('vnew')
|
||||
else:
|
||||
neovim.server.command('vsplit {}'.format(prepare_filename(fname)))
|
||||
|
||||
if flags.c and neovim.is_attached():
|
||||
for cmd in flags.c:
|
||||
|
Loading…
Reference in New Issue
Block a user