我正在编写一个用于meson的小插件:我使用makeprg
变量来设置命令,因此可以从quickfix窗口中受益。设置变量后,我调用make,然后再调用另一个本地函数:
function s:LinkCompilationDatabase()
...
endfunction
function s:MesonSetup() abort
let &makeprg = 'meson setup builddir'
silent make|redraw!
s:LinkCompilationDatabase()
endfunction
失败,出现此错误:
Error detected while processing function <SNR>22_MesonSetup:
line xx:
E21: Cannot make changes, 'modifiable' is off
无论make步骤有没有错误,都没有关系。
如何在make
之后调用函数?
使用:call
调用函数,并使用:let
存储函数结果/表达式。