summary refs log tree commit diff
path: root/.vim/lua/job.lua
diff options
context:
space:
mode:
Diffstat (limited to '.vim/lua/job.lua')
-rw-r--r--.vim/lua/job.lua10
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