From 6b41ca2bd9911d1e7264b405a2c4292c154ae384 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 28 Sep 2022 18:46:37 +0200 Subject: vim/job: try to detect makefile --- .vim/lua/job.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to '.vim') diff --git a/.vim/lua/job.lua b/.vim/lua/job.lua index cb5e95a..f9f7bf3 100644 --- a/.vim/lua/job.lua +++ b/.vim/lua/job.lua @@ -109,12 +109,14 @@ 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) + if not (string.match(makeprg, 'make') == nil) then + -- detect makefile + cwd = require('lspconfig.util').root_pattern('Makefile')(cwd) + end + + table.foreach(extra_args or {}, function(_, v) table.insert(args, v) end) return M.jobstart { command = command, -- cgit 1.4.1