diff options
| author | Robert Günzler <r@gnzler.io> | 2022-07-01 16:59:51 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-08-02 22:13:50 +0200 |
| commit | 4970afe7eafde2c4bb827d59d837ff7181d9c8c3 (patch) | |
| tree | cc80c230f78a1de9447d34f8c9eb64fc4baf2fab /.vim/lua | |
| parent | bfc89865e1894f8aef60cc3c9bbde9f22b228ca1 (diff) | |
vim: clear quickfix in job helper and find makefile automagically
Diffstat (limited to '.vim/lua')
| -rw-r--r-- | .vim/lua/job.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.vim/lua/job.lua b/.vim/lua/job.lua index d3f4b81..bf02fc6 100644 --- a/.vim/lua/job.lua +++ b/.vim/lua/job.lua @@ -30,6 +30,11 @@ function M.jobstart(opts) opts.on_start = vim.schedule_wrap(function(j) table.insert(M.current_jobs, j.pid, j) + if opts.populate_quickfix then + -- clear quickfix + vim.fn.setqflist({}, 'r') + end + if opts.enable_spinner then spinner.on_attach(j.pid, title, vim.fn.bufnr()) spinner.on_progress('begin', j.pid, j.pid) @@ -99,12 +104,17 @@ function M.make(extra_args) local command = args[1] table.remove(args, 1) + -- detect makefile + local cwd = vim.fn.expand('%:p:h') + cwd = require('lspconfig.util').root_pattern('Makefile')(cwd) + local extra_args = extra_args or {} table.foreach(extra_args, function(_, v) table.insert(args, v) end) return M.jobstart { command = command, args = args, + cwd = cwd, } end |