feat: nvim make recompilation easier
This commit is contained in:
@@ -68,23 +68,7 @@ vim.g.compile_mode = {
|
|||||||
buffer_name = "*compile*",
|
buffer_name = "*compile*",
|
||||||
baleia_setup = true,
|
baleia_setup = true,
|
||||||
}
|
}
|
||||||
vim.keymap.set("n", "<leader>c", function()
|
vim.keymap.set("n", "<leader>c", "<cmd>Recompile<cr>", {silent = true})
|
||||||
local id = -1
|
|
||||||
local bufname = vim.g.compile_mode.buffer_name
|
|
||||||
for _, bufid in ipairs(vim.api.nvim_list_bufs()) do
|
|
||||||
local name = vim.api.nvim_buf_get_name(bufid)
|
|
||||||
if string.sub(name, -string.len(bufname)) == bufname then
|
|
||||||
id = bufid
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if id == -1 then
|
|
||||||
vim.cmd("Recompile")
|
|
||||||
else
|
|
||||||
vim.bo[id].buflisted = false
|
|
||||||
vim.api.nvim_buf_delete(id, { unload = false })
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local file_types = { "rust", "zig", "haskell", "c", "cpp" }
|
local file_types = { "rust", "zig", "haskell", "c", "cpp" }
|
||||||
require("nvim-treesitter").install(file_types)
|
require("nvim-treesitter").install(file_types)
|
||||||
|
|||||||
Reference in New Issue
Block a user