From 4970afe7eafde2c4bb827d59d837ff7181d9c8c3 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Fri, 1 Jul 2022 16:59:51 +0200 Subject: vim: clear quickfix in job helper and find makefile automagically --- .vim/lua/job.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '.vim/lua') 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 -- cgit 1.4.1