vim-pad

minimal etherpad alternative - vim plugin
git clone https://git.ce9e.org/vim-pad.git

commit
2450adf7f6fe7310c7c7603df87a774777fb2065
parent
83c2c7b310faac8b0b30321c31e47cdbd968cb6a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-05-29 14:37
do not set to modifed on remote changes

Diffstat

M python/pad/__init__.py 8 +++++++-

1 files changed, 7 insertions, 1 deletions


diff --git a/python/pad/__init__.py b/python/pad/__init__.py

@@ -55,7 +55,6 @@ class Pad:
   55    55 			try:
   56    56 				r = requests.post(self.url, json=data)
   57    57 				r.raise_for_status()
   58    -1 				vim.command('setl nomodified')
   59    58 			except Exception as e:
   60    59 				print(e)
   61    60 				self.local_changes = [*self.staged_changes, *self.local_changes]
@@ -96,6 +95,12 @@ class Pad:
   96    95 			else:
   97    96 				self.apply_changes(msg[2])
   98    97 
   -1    98 	def reset_modified(self):
   -1    99 		if self.local_changes or self.staged_changes:
   -1   100 			vim.command('setl modified')
   -1   101 		else:
   -1   102 			vim.command('setl nomodified')
   -1   103 
   99   104 
  100   105 def on_open():
  101   106 	pad = Pad(vim.current.buffer)
@@ -131,3 +136,4 @@ def on_channel(msg):
  131   136 			pad.staged_changes = []
  132   137 		else:
  133   138 			pad.apply_changes(data[2])
   -1   139 		pad.reset_modified()