2013-06-29 30 views
1

我有一个Vim命令进入“分神”模式:为什么Vim不会在这个命令中执行我的列设置?

command! DistractionFreeMode set guioptions-=r gfn=Cousine:h12 showtabline=0 fullscreen laststatus=0 noruler wrap linebreak nolist linespace=5 foldcolumn=3 nonumber columns=80 

还请注意,我使用的MacVim。作品的命令排序,但一些设置似乎没有被触发。这些包括columns=80nolist。执行此命令后,我总是必须单独设置这些命令才能使它们正确。我也尝试将这些设置放入一个我使用该命令调用的函数中,并且具有相同的问题。这个问题的根源是什么?

编辑:这是我瞄准的外观的屏幕截图。使用fullscreencolumns在一起,要做到这一点,因为据我所知:

enter image description here

+0

您在同一时间有列= 80和全屏在那里。这两个命令可能不会很好地相互配合。你确定你想要他们两个吗?我也无法复制不被激活的nolist。检查是否有任何激活列表的autocmd。 – FDinoff

+0

@FDinoff嗯,现在我不能重现'nolist'也没有设置...所以忘掉那个(但谢谢你检查!)。是的,我希望列和全屏可以在一起。在屏幕截图中(我现在发布的内容)包含在上面的外观是必要的。当我在运行命令后设置列时,它们似乎能够很好地协同工作。 –

回答

2

根据您的帮助全屏(:h fullscreen)有选择定制的,当你进入全屏模式会发生什么行为这与fuoptions

在我的MacVim fuoptions设置设为

fuoptions=maxvert,maxhotz 

当我们看:h fuoptions

maxvert When entering fullscreen, 'lines' is set to the maximum number 
      of lines fitting on the screen in fullscreen mode. When 
      leaving fullscreen, if 'lines' is still equal to the maximized 
      number of lines, it is restored to the value it had before 
      entering fullscreen. 
    maxhorz When entering fullscreen, 'columns' is set to the maximum number 
      of columns fitting on the screen in fullscreen mode. When 
      leaving fullscreen, if 'columns' is still equal to the maximized 
      number of columns, it is restored to the value it had before 
      entering fullscreen. 

这意味着,当你进入全屏模式的MacVim调整大小以到线,它可以列的最大数量。 (忽略您设置的值)

要解决此问题,您可以添加set fuoption-=maxhorz以删除违规选项,或者添加set=maxvert以强制其仅使用maxvert(无论是否设置了其他选项)。这会阻止MacVim在水平方向上覆盖您的设置。

所以你的固定命令将看起来像

command! DistractionFreeMode set guioptions-=r gfn=Cousine:h12 showtabline=0 fuoptions-=maxhorz fullscreen laststatus=0 noruler wrap linebreak nolist linespace=5 foldcolumn=3 nonumber columns=80 
+0

完美。非常感谢。我应该更好地认识并阅读帮助 –

相关问题