change makeprg for shebang files

This commit is contained in:
2025-07-02 18:10:27 +02:00
parent aa3362e88e
commit f2178ab7fd
+12
View File
@@ -83,6 +83,18 @@ vim.api.nvim_create_autocmd({
end end
}) })
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
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 = './%'
end
end
end,
})
local function file_exists(name) --{{{1 local function file_exists(name) --{{{1
local f = io.open(name,"r") local f = io.open(name,"r")
if f~=nil then if f~=nil then