keybind inc
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user