Add ada mode

This commit is contained in:
2025-01-24 21:41:28 +01:00
parent 59dc3784af
commit 5b1d0d66de
3 changed files with 19 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ end
-- @param
-- @short Verify installation of ada tools or install them.
local function setup_ada()
vim.keymap.set("n", "<leader>cb", ":!gnatpp %<cr>")
vim.keymap.set("n", "<leader>kk", ":!gnatpp %<cr>")
vim.opt.tabstop = 3
vim.opt.shiftwidth = 3
end
@@ -30,3 +30,19 @@ vim.api.nvim_create_autocmd({ "BufLeave" }, {
pattern = { "*.adb", "*.ads" },
callback = leave_ada,
})
-- @name format_file
-- @param
-- @short Run gnatpp as formatter on the current file.
local function format_file()
vim.cmd("checktime %")
local write_cmd = "gnatpp " .. vim.api.nvim_buf_get_name(0)
os.execute(write_cmd)
vim.cmd("checktime %")
end
-- Add formatter command
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.adb", "*.ads" },
callback = format_file,
})