How to start gvim using max window from bash - script in gnome

I want to write bash - a script that starts a gvim session directly in a maximally maximized window.

This is my bash script:

#!/bin/bash - set -o nounset cd /home/alexthebird/vim-stuff; # directory of the gvim-session file gvim -S bootmap; # start gvim from the sessionfile 'bootmap' 

Do you have any idea how to do this with bashscript? Gvim should be maximized only when it runs on this script. Of course, any other ideas on how to do this are welcome.

I am using Ubuntu 11.04 with gnome.

Thanks for taking the time to read my post.

AlexTheBird

This script works:

 #!/bin/bash - set -o nounset # directory of the gvim-session file cd /home/alexthebird/vim-stuff; # -f because of a ubuntu global-menu bug # -S starts from session-file named 'bootmap' # -geom solved the problem. see post of Lstor gvim -geom '200x50+0+0' -f -S bootmap; # start gvim from the sessionfile 'bootmap'; 

Thank you all for your time.

EDIT: I just found out that the solution above works only for desktop with unity-2d (without 3D acceleration) . It is good for me. It does not work with the standard Ubuntu desktop, which uses the 3D version of Unity with acceleration.

+4
source share
3 answers

You can use the -geom (etry) option to match the size with the size of your monitor (s).

 gvim -geom 200x50+0+0 

Where 200 is the number of characters that you can place horizontally, 50 equally vertically, and +0+0 indicates zero horizontal and vertical offset in the upper left corner of the screen.

Please note that the window will not be maximized as such, it will be (approximately) the same size as your display.

+2
source

The following works for me on Ubuntu 8.04, Gnome (based on comments on this forum ):

 #!/bin/bash gvim sleep 1 # give gvim time to launch wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz 

You may need to install wmctrl :

 sudo apt-get install wmctrl 
+5
source

like @ Kurt Nelson, I use wmctrl , with autocmd and guienter . It works on both my windows 7 and Ubuntu 13.10.

  • Install wmctrl: sudo apt-get install wmctrl
  • add a script to the configuration.

script:

 if has("gui_running") if MySys() == 'linux' autocmd GUIEnter * silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz else winpos 0 0 set lines=99999 columns=99999 autocmd guienter * let &columns = 999 | let &columns = &columns/2 autocmd guienter * set lines=9999 columns=9999 endif endif 
0
source

All Articles