Search code examples
vimvim-plugin

How to call a function after quickfix windows was opened by calling make


I'm writing a small plugin to work with meson: I use the makeprg variable to set up the command, so I can benefit from the quickfix window. After I set the variable I call make and after that I want to call another local function:

  function s:LinkCompilationDatabase()
    ...
  endfunction

  function s:MesonSetup() abort
    let &makeprg = 'meson setup builddir'
    silent make|redraw!

    s:LinkCompilationDatabase()
  endfunction

It fails with this error:

  Error detected while processing function <SNR>22_MesonSetup:
  line   xx:
  E21: Cannot make changes, 'modifiable' is off

It doesn't make any difference if the make step has an error or not.

How do I call a function after make?


Solution

  • Use :call to call a function, and :let to store a function result/an expression.