I'm writing a debugger and when hitting a breakpoint or stepping through code I'm making a system call that instructs a gVim server to jump to the current line of the file being debugged, like this:

system_call("gvim --remote-send +\"%dG" --servername DEBUG --remote-tab-silent %s",
             line_number, file_name);

The problem is each time gVim receives the command the gVim window steals focus and I have to alt-tab or mouse-click back to the debugger window.

How can I prevent the gVim server window stealing focus when it receives at command?

(I've tagged the question with microsoft-windows and linux as I alternate between both operating systems and as such an answer would ideally work on both.)

  • Are you looking for :help -f? – romainl May 21 '16 at 6:14
  • @romainl I added -f to the call to gVim and it made no difference; it sill steals focus on every call. What were you thinking it would do? – x-x May 21 '16 at 8:26
  • 1
    @x-x did you ever solve this? interestingly i have the opposite problem: i cannot make gvim get focus with remote_foreground() – RJ- Oct 3 '17 at 15:59
  • @JackeJR No, I never solved it. – x-x Oct 6 '17 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.