I am not getting how to implement the following from Tinymist Docs in Nixvim
vim.api.nvim_create_user_command("OpenPdf", function()
local filepath = vim.api.nvim_buf_get_name(0)
if filepath:match("%.typ$") then
local pdf_path = filepath:gsub("%.typ$", ".pdf")
vim.system({ "open", pdf_path })
end
end, {})
Thats how I am currently trying to do it with no success.
programs.nixvim.userCommands = {
"Hallo" = {
command = ''
function()
print("Hallo, NixVim!")
end
'';
};
"OpenPdf" = {
command = ''
function()
local filepath = vim.api.nvim_buf_get_name(0)
if filepath:match("%.typ$") then
local pdf_path = filepath:gsub("%.typ$", ".pdf")
vim.system({ "xdg-open", pdf_path })
end
end
'';
};
};