Temporarily reset &modified when opening files

:edit and similar commands used by the --remote* options throw an exception if
the buffer is modified:

    E37: No write since last change (add ! to override)

Using :enew! doesn't work, since it reverts all changes. Thus we simply reset
&modified temporarily.

References https://github.com/mhinz/neovim-remote/issues/54
remotes/origin/master
Marco Hinz 7 years ago
parent 3fc53ac12a
commit 6845b8b5a6
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

@ -100,6 +100,10 @@ class Neovim():
if not self.is_attached(silent): if not self.is_attached(silent):
return return
modified = self.server.current.buffer.options['modified']
if modified:
self.server.current.buffer.options['modified'] = False
cmds, files = split_cmds_from_files(arguments) cmds, files = split_cmds_from_files(arguments)
for fname in files: for fname in files:
@ -126,6 +130,9 @@ class Neovim():
for cmd in cmds: for cmd in cmds:
self.server.command(cmd if cmd else '$') self.server.command(cmd if cmd else '$')
if modified:
self.server.current.buffer.options['modified'] = True
return len(files) return len(files)
def _show_msg(self, old_address): def _show_msg(self, old_address):

@ -18,7 +18,7 @@ setup(
'console_scripts': ['nvr = nvr.nvr:main'] 'console_scripts': ['nvr = nvr.nvr:main']
}, },
packages = ['nvr'], packages = ['nvr'],
version = '1.8.0', version = '1.8.1',
license = 'MIT', license = 'MIT',
keywords = 'neovim nvim nvr remote helper', keywords = 'neovim nvim nvr remote helper',
classifiers = [ classifiers = [

Loading…
Cancel
Save