|
|
@@ -4,15 +4,28 @@ local gitsigns = require("gitsigns")
|
|
|
|
|
|
-- local tree = require "nvim-tree.api"
|
|
|
|
|
|
-function FormatBuffer(command)
|
|
|
+function FormatBuffer()
|
|
|
-- Save the current cursor position
|
|
|
local cursor_position = vim.fn.getpos(".")
|
|
|
-
|
|
|
- -- Run the formatter command on the current buffer
|
|
|
+ local command = "typstyle"
|
|
|
+ -- -- Run the formatter command on the current buffer
|
|
|
vim.cmd(":%! " .. command)
|
|
|
-
|
|
|
-- Restore the cursor position
|
|
|
- vim.fn.setpos(".", cursor_position)
|
|
|
+ vim.fn.setpos(".", cursor_position)
|
|
|
+
|
|
|
+ -- local current_file = vim.fn.expand("%:p")
|
|
|
+ -- local cmd = string.format("typstyle -i %s", current_file)
|
|
|
+ -- vim.fn.jobstart(cmd, {
|
|
|
+ -- on_exit = function(_, exit_code)
|
|
|
+ -- if exit_code == 0 then
|
|
|
+ -- print("TypestStyle completed successfully")
|
|
|
+ -- -- vim.cmd('edit!') -- Reload the buffer
|
|
|
+ -- vim.fn.setpos(".", cursor_position)
|
|
|
+ -- else
|
|
|
+ -- print("TypestStyle failed with exit code: " .. exit_code)
|
|
|
+ -- end
|
|
|
+ -- end,
|
|
|
+ -- })
|
|
|
end
|
|
|
|
|
|
function ToggleTree(source)
|
|
|
@@ -80,7 +93,7 @@ wk.add({
|
|
|
{
|
|
|
"<leader>ft",
|
|
|
function()
|
|
|
- FormatBuffer("typstfmt")
|
|
|
+ FormatBuffer("typststyle")
|
|
|
end,
|
|
|
desc = "Typst fmt",
|
|
|
},
|