简体   繁体   English

如何使用.vimrc在启动时最大化vim的窗口?

[英]How to maximize vim's windows on startup with .vimrc?

我可以在.vimrc或.gvimrc中添加一些内容以使gvim始终在最大化的GUI窗口中启动吗?

On linux with most window managers and wmctrl installed you can maximize Gvim using the following command: 在安装了大多数窗口管理器和wmctrl linux上,可以使用以下命令最大化wmctrl

call system('wmctrl -i -b add,maximized_vert,maximized_horz -r '.v:windowid)

. Note: I am intentionally avoiding -b add,fullscreen mentioned in man wmctrl as it means different thing: at least in fluxbox that means that from now on this desktop you can see only either gvim or something else at a time, not both, and gvim is left without window decorations (not that I really care about them). 注意:我有意避免man wmctrl提到的-b add,fullscreen ,因为它意味着不同的东西:至少在fluxbox中,这意味着从现在开始在此桌面上一次只能看到gvim或其他内容,而不能同时看到两者。 gvim没有窗口装饰(不是我真的很在乎它们)。 Eg if you popup yakuake* gvim disappears until yakuake hides. 例如,如果弹出yakuake * gvim消失,直到yakuake隐藏。

* terminal emulator, pops like console in some FPS games *终端模拟器,在某些FPS游戏中像控制台一样弹出

It looks like if you're using Windows, it's as easy as adding this line into your .vimrc: 看起来,如果您使用的是Windows,就像将以下行添加到.vimrc中一样简单:

au GUIEnter * simalt ~x

(type :help maximize or :help win16-maximized for details) (输入:help maximize :help win16-maximized:help win16-maximized以获得详细信息)

Apparently there's no standard way to do it on other platforms from your vimrc. 显然,从vimrc在其他平台上没有标准的方法可以做到这一点。 The simplest trick without knowing which platform is to add 不知道要添加哪个平台的最简单技巧

set lines=999 columns=999

to your .gvimrc. 到您的.gvimrc。 There are a few other tricks that can help at the Vim Wiki's Maximize or set initial window size page. Vim Wiki的“ 最大化”或“设置初始窗口大小”页面上还有其他一些技巧可以提供帮助。

You can set the initial size of the Vim Window by adding the following line to ~/.vimrc : 您可以通过在~/.vimrc添加以下行来设置Vim窗口的初始大小:

set lines=50 columns=100 (just an example) set lines=50 columns=100 (仅作为示例)

I set my vim to my screen resolution, ie set lines=768 columns=1366 . 我将我的vim设置为我的屏幕分辨率,即set lines=768 columns=1366 Now my Vim editor automatically launches in fullscreen. 现在,我的Vim编辑器会自动以全屏模式启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM