From 269c827a7b3e19885e1c5dc0bef4d5b5865b6000 Mon Sep 17 00:00:00 2001 From: THEON-1 Date: Thu, 27 Nov 2025 11:24:45 +0100 Subject: [PATCH] keybind inc --- lua/config/ftkeybinds.lua | 26 +++++++++++++++++++++++--- lua/config/keybinds.lua | 8 ++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/lua/config/ftkeybinds.lua b/lua/config/ftkeybinds.lua index 53d6105..3a9226f 100644 --- a/lua/config/ftkeybinds.lua +++ b/lua/config/ftkeybinds.lua @@ -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) diff --git a/lua/config/keybinds.lua b/lua/config/keybinds.lua index 3292ee3..dc62d3f 100644 --- a/lua/config/keybinds.lua +++ b/lua/config/keybinds.lua @@ -24,12 +24,12 @@ vim.keymap.set("n", "x", "!chmod +x %", {silent = true}) vim.keymap.set("n", "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