added F6 for additional options in ftkeybinds
This commit is contained in:
@@ -1,17 +1,22 @@
|
|||||||
local function markdown()
|
local function markdown(options)
|
||||||
local pandoc_process = vim.system({
|
local options_list = {}
|
||||||
"pandoc",
|
for opt in options:gmatch("%S+") do
|
||||||
vim.fn.expand("%:p"),
|
table.insert(options_list, opt)
|
||||||
"-o",
|
end
|
||||||
vim.fn.expand("%:p:r") .. ".pdf",
|
local cmd = vim.list_extend(
|
||||||
"--verbose",
|
{ "pandoc" },
|
||||||
})
|
options_list
|
||||||
|
)
|
||||||
|
table.insert(cmd, vim.fn.expand("%:p"))
|
||||||
|
table.insert(cmd, "-o")
|
||||||
|
table.insert(cmd, vim.fn.expand("%:p:r") .. ".pdf")
|
||||||
|
local pandoc_process = vim.system(cmd)
|
||||||
local pandoc_result = pandoc_process:wait()
|
local pandoc_result = pandoc_process:wait()
|
||||||
vim.notify(pandoc_result.stdout, vim.log.levels.INFO);
|
vim.notify(pandoc_result.stdout, vim.log.levels.INFO);
|
||||||
vim.notify(pandoc_result.stderr, vim.log.levels.ERROR);
|
vim.notify(pandoc_result.stderr, vim.log.levels.ERROR);
|
||||||
end
|
end
|
||||||
|
|
||||||
local function arduino()
|
local function arduino(options)
|
||||||
local arduino_process = vim.system({
|
local arduino_process = vim.system({
|
||||||
"arduino-cli",
|
"arduino-cli",
|
||||||
"board",
|
"board",
|
||||||
@@ -54,7 +59,7 @@ local function arduino()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<F5>", function()
|
local function run_ft_action(options)
|
||||||
local default = {
|
local default = {
|
||||||
__index = function()
|
__index = function()
|
||||||
return function() end
|
return function() end
|
||||||
@@ -66,6 +71,12 @@ vim.keymap.set("n", "<F5>", function()
|
|||||||
}
|
}
|
||||||
setmetatable(fttable, default)
|
setmetatable(fttable, default)
|
||||||
|
|
||||||
fttable[vim.bo.filetype]()
|
fttable[vim.bo.filetype](options)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<F5>", function () run_ft_action("") end)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<F6>", function()
|
||||||
|
run_ft_action(vim.fn.input("enter additional options"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user