Linux 如何以最大化的窗口启动 gvim?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4722684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:32:30  来源:igfitidea点击:

How do I start gvim with a maximized window?

linuxconfigurationvim

提问by Tomas F

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

我想从命令行启动 gvim,进入一个最大化的窗口 - 我该怎么做?

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

我不想总是在最大化的窗口中启动(也就是说,不在.vimrc 中将其配置为默认值),而是选择为程序提供一个参数。

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

也就是说,运行gvim <parameter(s)>应该在最大化的窗口中启动程序,而只是运行gvim应该以默认大小启动程序。

采纳答案by grep

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

就像许多其他 Gtk+ 应用程序一样,gvim 理解参数-geometry。尝试例如

gvim -geometry 500x500

回答by Node17

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.

您应该能够通过进入 vimrc 文件来更改大小,您可以在其中指定大小或在打开时将其最大化。

Have a look here.

看看这里。

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

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

回答by Ryan Shillington

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

对我来说(我在 Ubuntu 11.10 上),将它添加到我的 .vimrc 似乎可以解决问题。无需几何设置等。

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

回答by Artran

On Windows 7 I have this in my _vimrc:

在 Windows 7 上,我的 _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.

所以当我在 diff 模式下(例如从 TortoiseSVN)运行 Vim 时,Vim 开始最大化。

Similarly, it can be changed to:

同样,它可以改为:

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

回答by nothing-special-here

Put to .vimrc

.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

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

回答by Deqing

On Windows you can try add following to your _vimrc

在 Windows 上,您可以尝试将以下内容添加到您的 _vimrc

au GUIEnter * simalt ~x

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

请注意,~x来自菜单选项的键盘快捷键,它可能因不同的操作系统语言而异。所以检查欲望选项的快捷方式并尝试它。

回答by Patrick.SE

On Linux I use this in my .vimrc:

在 Linux 上,我在我的 .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.

这个自动命令将在 VimEnter 事件被触发后触发。发生这种情况时,它会在当前窗口上运行 wmctrl 以最大化它。

This requires that you have wmctrlinstalled.

这要求您安装了wmctrl