用户工具

站点工具


linux:vim:gui-mode

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

linux:vim:gui-mode [2011/03/29 09:19] (当前版本)
行 1: 行 1:
 +====== 判断当前是VIM还是GVIM模式 ======
 +
 +===== 方法一 =====
 +
 +If Vim is running in GUI mode, or if it is in startup and knows that GUI mode will be started at the end of startup, has('​gui_running'​) returns 1 (i.e. TRUE). Otherwise it returns 0 (i.e. FALSE). You can test this (unless running on a Vim without arithmetic evaluation) with
 +
 +<​code>​
 +       if has('​gui_running'​)
 +               "​ gvim-only stuff
 +       else
 +               "​ non-gvim stuff
 +       endif
 +</​code>​
 +或者
 +<​code>​
 +       if !has('​gui_running'​)
 +               "​ this won't be done when staying in console mode
 +       endif
 +</​code>​
 +==== 参考 ====
 +  * :help has()
 +  * :help feature-list
 +  * :help no-eval-feature
 +
 +
 +
 +===== 方法二 =====
 +
 +Whenever the GUI is started (be it during startup, or, on a Unix Vim, by executing the :gui command at any time), your gvimrc is sourced and (provided, of course, that autocommands are compiled-in) the GUIEnter autocommand event is triggered. Neither happens if Vim runs in console mode.
 +
 +==== 参考 ==== 
 +  * :help gui.txt
 +  * :help GUIEnter
 +
  
linux/vim/gui-mode.txt · 最后更改: 2011/03/29 09:19 (外部编辑)