VimL: Checking if function exists

前端 未结 3 1723
梦如初夏
梦如初夏 2021-02-12 04:16

right now I\'m cleaning up my .vimrc file to make sure it\'s compatible on most systems.

In my statusline I use a function that another plugin sets, the

3条回答
  •  青春惊慌失措
    2021-02-12 05:00

    Just as an alternative you may also use a regexp to decide if the plugin at hand is in your runtimepath:

    if &rtp =~ 'plugin-name'
        ...
    endif
    

    This has the advantage that it works with plugins that only have vimscript code in the autoload directory, which in turn can't be detected when .vimrc is initially parsed since the autoload snippets are loaded at the time of a function call.

提交回复
热议问题