summaryrefslogtreecommitdiffstats
path: root/shared_vim.vim
diff options
context:
space:
mode:
Diffstat (limited to 'shared_vim.vim')
-rw-r--r--shared_vim.vim8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared_vim.vim b/shared_vim.vim
index d2b06f5..8a3fea2 100644
--- a/shared_vim.vim
+++ b/shared_vim.vim
@@ -178,6 +178,9 @@ def nums_to_rcs(lines, nums):
else:
break
num = num_max + 1
+ for index in range(len(rcs)):
+ if rcs[index] is None:
+ rcs[index] = (len(lines) - 1, len(lines[-1]))
return rcs
@@ -224,6 +227,8 @@ def main():
raise Exception('from server: ' + response[JSON_TOKEN.ERROR])
else:
lines = re.split(r'\n', response[JSON_TOKEN.TEXT])
+ if not lines:
+ lines = ['']
rcs = nums_to_rcs(lines, response[JSON_TOKEN.CURSORS])
my_rc = nums_to_rcs(lines, [response[JSON_TOKEN.CURSOR]])[0]
@@ -247,11 +252,14 @@ function! SharedVimEventsHandler(event_name)
if exists('b:shared_vim_server_name')
if a:event_name == 'VimCursorMoved'
call SharedVimSync()
+ elseif a:event_name == 'VimCursorMovedI'
+ call SharedVimSync()
endif
endif
endfunction
autocmd CursorMoved * call SharedVimEventsHandler('VimCursorMoved')
+autocmd CursorMovedI * call SharedVimEventsHandler('VimCursorMovedI')
highlight SharedVimOthersCursors ctermbg=darkred