Tomas F
Tomas F

Reputation: 7596

How do I start gvim with a maximized window?

I would like to start gvim, from the command line, into a maximized window - how can I do this?

I have no wish to always start in a maximized window (that is, not configure it as default in .vimrc), but rather choose to provide a parameter to the program.

That is, running gvim <parameter(s)> should start the program in a maximized window but just running gvim should start the program with the default size.

Upvotes: 21

Views: 17211

Answers (7)

Patrick.SE
Patrick.SE

Reputation: 4564

On Linux I use this in my .vimrc:

augroup maximizewindow 
    autocmd! 
    autocmd VimEnter * call system('wmctrl -i -b add,maximized_vert,maximized_horz -r '.v:windowid)
augroup END

This auto command will trigger after the VimEnter event has been triggered. When that happens it runs wmctrl on the current window to maximize it.

This requires that you have wmctrl installed.

Upvotes: 3

Node17
Node17

Reputation: 537

You should be able to change the size by going into the vimrc file, where you can specify the size or maximize it on open.

Have a look here.

http://vim.wikia.com/wiki/Maximize_or_set_initial_window_size

Upvotes: 11

Ryan Shillington
Ryan Shillington

Reputation: 25207

For me (I'm on Ubuntu 11.10), adding this to my .vimrc seems to do the trick. No need for geometry settings, etc.

if has("gui_running")
  " GUI is running or is about to start.
  " Maximize gvim window.
  set lines=999 columns=999
endif

Upvotes: 16

Deqing
Deqing

Reputation: 14652

On Windows you can try add following to your _vimrc

au GUIEnter * simalt ~x

Note that ~x comes from keyboard shortcut for menu option, it might vary on different OS language. So check the shortcut for desire option and try it.

Upvotes: 3

nothing-special-here
nothing-special-here

Reputation: 12618

Put to .vimrc

" Maximize GVim on start
if has("gui_running")
  set lines=999 columns=999
endif

stolen from: http://vim.wikia.com/wiki/Maximize_or_set_initial_window_size

Upvotes: 5

Artran
Artran

Reputation: 71

On Windows 7 I have this in my _vimrc:

" Run maximized in diff mode
if &diff 
   au GUIEnter * simalt ~x
else
   set lines=55 columns=130
endif

So when I run Vim in diff mode (e.g. from TortoiseSVN), Vim starts maximized.

Similarly, it can be changed to:

" Run maximized in GUI
if has("gui_running")
   au GUIEnter * simalt ~x
endif

Upvotes: 7

Maxim Razin
Maxim Razin

Reputation: 9466

Just like many other Gtk+ apps, gvim understands the parameter -geometry. Try for example

gvim -geometry 500x500

Upvotes: 17

Related Questions