Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bringing gvim to foreground

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!

like image 377
Alex Biba Avatar asked Feb 16 '23 09:02

Alex Biba


2 Answers

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.

like image 115
Kurt Avatar answered Feb 26 '23 09:02

Kurt


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

vim -c "call remote_foreground('$VIMSERVER')" -c quit
like image 43
Ingo Karkat Avatar answered Feb 26 '23 09:02

Ingo Karkat