2012-11-08 56 views
59

我想知道哪些編譯選項用於我的Vim二進制文件。有什麼方法可以查詢嗎?如何檢查vim編譯的選項?

具體來說,我感興趣的是它是否啓用了Python支持。

回答

65

你可以看到一切VIM被執行

:version 

要查詢像Python的確切功能,您可以使用has()功能與您正在尋找的功能編譯。下面的代碼將返回1,如果它具有該功能,則返回1,否則返回0。

:echo has('python') 

有關功能的列表見:h feature-list

更多信息參見:

:h :version 
:h has(
:h feature-list 
+1

爲了完整起見:對於Vimscript中一個語法的例子是'如果有( '剪貼板')', 'set mouse = a','end'。如果我已經閱讀過,不會被困擾讀取幫助;-) – cfi

+0

當我運行':version'時,它顯示'+ python/dyn和+ python3/dyn'。但是echo('python')返回0.那麼,爲什麼會有差異,我應該選擇哪一個呢? –

+1

':version'顯示了Vim編譯的內容。在你的情況'python/dyn'和'+ python3/dyn'是動態加載版本的python。根據':h python-dynamic',這意味着Vim將搜索所需的python dll庫,如果發現可以使用python。試着'('python')'會嘗試加載python動態並返回結果(參見':h has-python')。因此'('python')'是首選的方法。 –

3

用vi --version - 顯示編譯選項和編譯器命令

12

使用vim --version。礦山顯示:

$ vim --version 
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02) 
Compiled by [email protected] 
Normal version without GUI. Features included (+) or not (-): 
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype 
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn 
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs 
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title 
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp 
-xterm_clipboard -xterm_save 
    system vimrc file: "$VIM/vimrc" 
    user vimrc file: "$HOME/.vimrc" 
    user exrc file: "$HOME/.exrc" 
fall-back for $VIM: "/usr/share/vim" 
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe 
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses