Vim 编译功能列表

Vim 编译功能列表

我知道如何检查某个功能是否已被编译:

:echo has("syntax")

如何获取所有可能的编译时功能的列表?

示例(伪代码):

foreach "feature" in "feature-list":
    print "has(feature)"

目标:构建一个供自己使用的 vim 插件,用于检测某些功能并根据某些条件进行“切换”。

答案1

目标:构建一个供自己使用的 vim 插件,用于检测某些功能并根据某些条件进行“切换”。

如果你“启用”某些功能,你仍然需要事先了解它们。将它们的名称直接硬编码到插件中有什么不好?!

Vim 的自我反思能力有限。您可以解析 的输出:version(其中包括功能列表)。我还看到过一个插件解析特定的帮助页面(例如$VIMRUNTIME/doc/options.txt)以获取设置列表,但如果您不需要它们,我建议您不要使用它们。

答案2

这是我的 Vim 版本(7.3.315)中可能的功能列表:

["all_builtin_terms", "amiga", "arabic", "arp", "autocmd", "balloon_eval", "balloon_multiline", "beos", "browse", "builtin_terms", "byte_offset", "cindent", "clientserver", "clipboard", "cmdline_compl", "cmdline_hist", "cmdline_info", "comments", "compatible", "cryptv", "cscope", "debug", "dialog_con", "dialog_gui", "diff", "digraphs", "dnd", "dos16", "dos32", "ebcdic", "emacs_tags", "eval", "ex_extra", "extra_search", "farsi", "file_in_path", "filterpipe", "find_in_path", "float", "fname_case", "folding", "footer", "fork", "fullscreen", "gettext", "gui", "gui_athena", "gui_gnome", "gui_gtk", "gui_gtk2", "gui_mac", "gui_macvim", "gui_motif", "gui_photon", "gui_running", "gui_win32", "gui_win32s", "hangul_input", "iconv", "insert_expand", "jumplist", "keymap", "langmap", "libcall", "linebreak", "lispindent", "listcmds", "localmap", "lua", "mac", "macunix", "menu", "mksession", "modify_fname", "mouse", "mouse_dec", "mouse_gpm", "mouse_netterm", "mouse_pterm", "mouse_sysmouse", "mouse_xterm", "mouseshape", "multi_byte", "multi_byte_encoding", "multi_byte_ime", "multi_lang", "mzscheme", "netbeans_enabled", "netbeans_intg", "odbeditor", "ole", "os2", "path_extra", "perl", "persistent_undo", "postscript", "printer", "profile", "python", "python3", "qnx", "quickfix", "reltime", "rightleft", "ruby", "scrollbind", "showcmd", "signs", "smartindent", "sniff", "spell", "startuptime", "statusline", "sun_workshop", "syntax", "syntax_items", "system", "tag_binary", "tag_old_static", "tag_any_white", "tcl", "terminfo", "termresponse", "textobjects", "tgetent", "title", "toolbar", "transparency", "unix", "user_commands", "vertsplit", "vim_starting", "viminfo", "virtualedit", "visual", "visualextra", "vms", "vreplace", "wildignore", "wildmenu", "win16", "win32", "win32unix", "win64", "win95", "winaltkeys", "windows", "writebackup", "xfontset", "xim", "xsmp", "xsmp_interact", "xterm_clipboard", "xterm_save", "x11"]

从 编译它大约需要 30 秒:h feature-list

相关内容