keybind inc

This commit is contained in:
THEON-1
2025-11-27 11:24:45 +01:00
parent 4a1006a062
commit 269c827a7b
2 changed files with 27 additions and 7 deletions

View File

@@ -7,13 +7,21 @@ local function markdown(options)
{ "pandoc" },
options_list
)
table.insert(cmd, "-s")
table.insert(cmd, vim.fn.expand("%:p"))
table.insert(cmd, "-o")
table.insert(cmd, vim.fn.expand("%:p:r") .. ".pdf")
table.insert(cmd, vim.fn.expand("%:p:r") .. ".tex")
local pandoc_process = vim.system(cmd)
local pandoc_result = pandoc_process:wait()
vim.notify(pandoc_result.stdout, vim.log.levels.INFO);
vim.notify(pandoc_result.stderr, vim.log.levels.ERROR);
local pdflatex_process = vim.system({
"pdflatex",
vim.fn.expand("%:p:r") .. ".tex",
})
local pdflatex_result = pdflatex_process:wait()
--vim.notify((pandoc_result.stdout .. "\n\n" .. pdflatex_result.stdout):gsub("^%s*", ""):gsub("%s*$", ""), vim.log.levels.INFO);
vim.notify((pandoc_result.stderr .. "\n\n" .. pdflatex_result.stderr):gsub("^%s*", ""):gsub("%s*$", ""), vim.log.levels.ERROR);
end
local function arduino(options)
@@ -59,6 +67,17 @@ local function arduino(options)
})
end
local function tex(options)
local pdflatex_process = vim.system({
"pdflatex",
vim.fn.expand("%:p"),
})
local pdflatex_result = pdflatex_process:wait()
vim.notify(pdflatex_result.stdout, vim.log.levels.INFO);
vim.notify(pdflatex_result.stderr, vim.log.levels.ERROR);
end
local function run_ft_action(options)
local default = {
__index = function()
@@ -68,6 +87,7 @@ local function run_ft_action(options)
local fttable = {
["markdown"] = markdown,
["arduino"] = arduino,
["tex"] = tex,
}
setmetatable(fttable, default)

View File

@@ -24,12 +24,12 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", {silent = true})
vim.keymap.set("n", "<leader>sb", function ()
local filetype = vim.bo.filetype
local mapping = {
jl = "julia",
julia = "julia",
jl = "/usr/bin/env julia",
julia = "/usr/bin/env julia",
sh = "bash",
zsh = "zsh",
py = "/usr/bin/env python3",
python = "/usr/bin/env python3",
py = "/usr/bin/env python",
python = "/usr/bin/env python",
}
local command = mapping[filetype]
if (command == nil) then return end