开发者

How do I start gvim with a maximized window?

I wou开发者_如何转开发ld 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.


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

gvim -geometry 500x500


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


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


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


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜