Skip to content

Windows-related patches, and a couple util patches #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions plugin/multimonitor.vim
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ function! Remote_Open(filename, command)
" Take focus on the new window
echom "Taking focus"
call foreground()


let s:in_remote_open = 1
let s:in_remote_open = 0
return "Server " . v:servername . " opened file " . a:filename
endfunction

function! Buf_Enter()
if s:buffer_to_cleanup != ""
echom "Cleaning up " . s:buffer_to_cleanup
bp
execute "bdelete " . s:buffer_to_cleanup
let s:buffer_to_cleanup = ""
endif
Expand All @@ -60,17 +62,20 @@ function! Swap_Exists()

let owning_server = ""
for server in s:other_servers()
if remote_expr(server, 'Do_You_Own("' . expand("<afile>") . '")') != "0"
if remote_expr(server, "Do_You_Own('" . expand("<afile>") . "')") != "0"
let owning_server = server
break
endif
endfor

let swapcommand = substitute(v:swapcommand, "\r", "", "g")
let remexpr = 'Remote_Open("' . expand("<afile>") . '", "' . swapcommand . '")'
let remexpr = "Remote_Open('" . expand("<afile>") . "', '" . swapcommand . "')"

echom remote_expr(owning_server, remexpr)
if has('win32')
call remote_foreground(owning_server)
endif

echom remote_expr(owning_server, remexpr)
" Cleanup the buffer to avoid dangling entries
let s:buffer_to_cleanup = expand("<afile>")

Expand Down