Add ada mode
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user