remove specific makeprg per filetype and instead use just

just is a fine generic command runner, and cross-platform.
This commit is contained in:
2026-04-01 13:36:23 +02:00
parent 481584f8f6
commit 83f1e0c977
+1 -22
View File
@@ -27,6 +27,7 @@ vim.cmd [[
set noswapfile set noswapfile
set list set list
set ignorecase set ignorecase
set makeprg=just
nnoremap ,co :copen<CR> nnoremap ,co :copen<CR>
nnoremap ,cc :cclose<CR> nnoremap ,cc :cclose<CR>
@@ -171,47 +172,25 @@ local file_specific = {
lua = function () lua = function ()
end, end,
go = function() go = function()
vim.bo.makeprg = 'go'
end, end,
c = function() c = function()
if not has_makefile() then
vim.bo.makeprg = 'tcc -run %'
end
vim.bo.expandtab = false vim.bo.expandtab = false
end, end,
cs = function() cs = function()
vim.bo.makeprg = "dotnet"
vim.bo.errorformat = "%f(%l\\,%c):\\ %t%*[^:]:\\ %m" vim.bo.errorformat = "%f(%l\\,%c):\\ %t%*[^:]:\\ %m"
vim.bo.errorformat = vim.bo.errorformat .. ",%\\s%#at\\ %m\\ in\\ %f:line\\ %l" vim.bo.errorformat = vim.bo.errorformat .. ",%\\s%#at\\ %m\\ in\\ %f:line\\ %l"
end, end,
python = function()
vim.bo.makeprg = 'basedpyright'
end,
swift = function()
vim.bo.makeprg = 'swift'
end,
tsv = function() tsv = function()
vim.bo.tabstop = 32 vim.bo.tabstop = 32
vim.bo.expandtab = false vim.bo.expandtab = false
end, end,
odin = function() odin = function()
vim.bo.expandtab = false vim.bo.expandtab = false
vim.bo.makeprg = 'odin run .'
end end
} }
vim.api.nvim_create_autocmd('BufEnter', { vim.api.nvim_create_autocmd('BufEnter', {
callback = function() callback = function()
do
local line = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]
if line then
local first_two = line:sub(1, 2)
if first_two == '#!' then
vim.bo.makeprg = './%'
return
end
end
end
local conf = file_specific[vim.bo.filetype] local conf = file_specific[vim.bo.filetype]
if conf then conf() end if conf then conf() end
end, end,