强制 vim 重新加载已加载的自动加载 vim 文件
Forcing vim to reload already loaded autoload vimfiles
我试图对 vim 在启动时加载的自动加载文件进行试验。
我将 example.vim 文件保存在:
~/.vim/autoload/
目录并编写了一个非常简单的函数:
echom "Autoloading..."
function! cpp#running#CompileAndRunFile(commands)
silent !clear
execute "!" . a:commands . " " . bufname("%")
endfunction
function! cpp#running#DebuggersOptions()
" Get the bytecode.
let bytecode = system(a:command . " -E -o " . bufname("%"))
" Open a new split and set it up.
vsplit __Bytecode__
normal! ggdG
setlocal filetype=potionbytecode
setlocal buftype=nofile
" Insert the bytecode.
call append(0, split(bytecode, '\v\n'))
endfunction
但我想以编程方式强制重新加载 Vim 已经加载的自动加载 example.vim 文件,而不打扰用户。原因是我希望程序员在 运行 时间可以更改函数的行为并加载最新修改的函数。
我该怎么做?
谢谢。
auto-load files which vim load at the time of start.
没有。自动加载功能恰恰相反:自动加载的脚本是在运行时获取的,当它包含的函数被调用时。
But I want to programatically force a reload of an autoload example.vim file which Vim has already loaded, without bothering the user.
:source
又是吗?
我试图对 vim 在启动时加载的自动加载文件进行试验。 我将 example.vim 文件保存在:
~/.vim/autoload/
目录并编写了一个非常简单的函数:
echom "Autoloading..."
function! cpp#running#CompileAndRunFile(commands)
silent !clear
execute "!" . a:commands . " " . bufname("%")
endfunction
function! cpp#running#DebuggersOptions()
" Get the bytecode.
let bytecode = system(a:command . " -E -o " . bufname("%"))
" Open a new split and set it up.
vsplit __Bytecode__
normal! ggdG
setlocal filetype=potionbytecode
setlocal buftype=nofile
" Insert the bytecode.
call append(0, split(bytecode, '\v\n'))
endfunction
但我想以编程方式强制重新加载 Vim 已经加载的自动加载 example.vim 文件,而不打扰用户。原因是我希望程序员在 运行 时间可以更改函数的行为并加载最新修改的函数。
我该怎么做?
谢谢。
auto-load files which vim load at the time of start.
没有。自动加载功能恰恰相反:自动加载的脚本是在运行时获取的,当它包含的函数被调用时。
But I want to programatically force a reload of an autoload example.vim file which Vim has already loaded, without bothering the user.
:source
又是吗?