如何在vim中设置默认窗口大小?


20

当我右键单击一个文件并在Vim中打开它时,默认窗口大小太小。如何更改设置以使默认窗口尺寸更大?

我正在Windows 7中运行Vim 7.3.46。

Answers:


26

您可以在〜/ .gvimrc(在Windows上为〜/ _gvimrc)中设置'lines''columns'选项。例如:

:set lines=35 columns=150

我不建议您在vimrc中执行此操作,因为如果可以的话,在控制台Vim中设置这些选项可能会产生奇怪的效果。gvimrc仅在启动gVim时加载。


1
可能还希望使其成为GUIEnter autocmd的一部分。另请参阅:h GUIEnter
pottsdl

12

该页面建议向_vimrc添加以下内容,以避免控制台Vim出现问题:

if has("gui_running")
  " GUI is running or is about to start.
  " Maximize gvim window.
  set lines=999 columns=999
else
  " This is console Vim.
  if exists("+lines")
    set lines=50
  endif
  if exists("+columns")
    set columns=100
  endif
endif

同样,这个SO问题着眼于如何记住上一个会话的窗口大小。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.