I have a function that I would like to run once and do nothing in subsequent calls to it. It handles lazy-loading of plugins.
function! LoadExpensivePlugins() call StuffToRunOnceOnly " what do i do here? endfun The simplest solution is simply to set a variable:
let s:LoadExpensivePluginsHasBeenRun = 0 function! LoadExpensivePlugins() if !(s:LoadExpensivePluginsHasBeenRun) call StuffToRunOnceOnly let s:LoadExpensivePluginsHasBeenRun = 1 endif endfun :delfunction as an answer, it seems more directly answering my original question.
E127: Cannot redefine function LoadExpensivePlugins: It is in use:delfunction(this won't work from within the function however (as you noted))