4

I am trying to make an alias for gvim that opens a file in a new tab using vim-server, the alias (for now) is:

/util/Linux/bin/gvim --servername $VIMSERVER --remote-tab-silent !*

While this is working, it leaves the gvim window in the background. I would like to bring the window to the front, tried several google solutions without success.

I am using RHEL 5.2, tcsh, vim 7.2, no root (work computer), and I don't have wmctrl installed (found some solutions that use wmctrl).

Help appreciated, thanks!

Alex Biba
  • 63
  • 5
  • If this isn't a built-in feature of Gvim, this might be a task for your [window manager](https://en.wikipedia.org/wiki/Window_manager). – timss May 30 '13 at 15:40

2 Answers2

6

I had the same problem but this appears to work when using KDE.

  1. right-click on gvim border and select 'Configure Window Behaviour'
  2. select 'Focus' from left side icons
  3. change dropdown 'Focus Stealing Prevention' to None

Hopefully that works for you too.

Kurt
  • 2,339
  • 2
  • 30
  • 31
  • I am not using KDE (but rather gnome 2.16) so 'Configure window behaviour' does not show up on right click menu. – Alex Biba Aug 18 '13 at 09:58
3

For this, there are the foreground() and remote_foreground() functions, as in:

vim -c "call remote_foreground('$VIMSERVER')" -c quit
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • Using this command as is only brings the gvim for a split second and then the terminal is brought to the foreground again. If I remove the "-c quit" it brings two windows to the front, my server and a new gvim window, when closing manually the new gvim windows, the terminal takes control and again is brought to the foreground, suggestions? – Alex Biba Jun 05 '13 at 09:13
  • Further research lead me to believe that the problem lies with RHEL that doesn't allow applications to override the window manager. I also tried using X11/Xlib's XRaiseWindow() without success. – Alex Biba Jun 05 '13 at 10:54