mirror of
https://github.com/Ascyii/typstar.git
synced 2026-01-01 13:34:24 -05:00
fix(anki): reload nvim buffer on anki id update
This commit is contained in:
@@ -17,7 +17,10 @@ local function run_typstar_anki(args)
|
||||
anki_key,
|
||||
args
|
||||
)
|
||||
utils.run_shell_command(cmd, true)
|
||||
local handle_output = function(msg)
|
||||
if string.match(msg, 'Done') then vim.cmd('checktime') end
|
||||
end
|
||||
utils.run_shell_command(cmd, true, handle_output)
|
||||
end
|
||||
|
||||
function M.scan() run_typstar_anki('') end
|
||||
|
||||
@@ -26,10 +26,12 @@ function M.insert_text_block(snip)
|
||||
vim.api.nvim_buf_set_lines(vim.api.nvim_get_current_buf(), line_num, line_num, false, lines)
|
||||
end
|
||||
|
||||
function M.run_shell_command(cmd, show_output)
|
||||
function M.run_shell_command(cmd, show_output, extra_handler)
|
||||
extra_handler = extra_handler or function(msg) end
|
||||
local handle_output = function(data, err)
|
||||
local msg = table.concat(data, '\n')
|
||||
if not string.match(msg, '^%s*$') then
|
||||
extra_handler(msg)
|
||||
local level = err and vim.log.levels.ERROR or vim.log.levels.INFO
|
||||
vim.notify(msg, level)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user