From 36a88dc9821778de86c4ec8378fb1cc4c99628ee Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 5 Mar 2026 22:00:50 -0500 Subject: [PATCH] fix(nvim): cleanup --- config/nvim/lua/plugins/dev.lua | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/config/nvim/lua/plugins/dev.lua b/config/nvim/lua/plugins/dev.lua index 8140f26..9ce81aa 100644 --- a/config/nvim/lua/plugins/dev.lua +++ b/config/nvim/lua/plugins/dev.lua @@ -307,6 +307,21 @@ return { synctex_pdf[args.data.bufnr] = args.data.output end, }) + vim.api.nvim_create_autocmd('CursorHold', { + pattern = '*.tex', + callback = function() + local pdf = synctex_pdf[vim.api.nvim_get_current_buf()] + if pdf then + vim.fn.jobstart({ + 'sioyek', + '--instance-name', 'preview', + '--forward-search-file', vim.fn.expand('%:p'), + '--forward-search-line', tostring(vim.fn.line('.')), + pdf, + }) + end + end, + }) vim.g.preview = { github = true, typst = { open = { 'sioyek', '--new-instance' } }, @@ -336,23 +351,5 @@ return { keys = { { 'p', 'Preview toggle' }, }, - after = function() - local function forward_search() - local pdf = synctex_pdf[vim.api.nvim_get_current_buf()] - if pdf then - vim.fn.jobstart({ - 'sioyek', - '--instance-name', 'preview', - '--forward-search-file', vim.fn.expand('%:p'), - '--forward-search-line', tostring(vim.fn.line('.')), - pdf, - }) - end - end - vim.api.nvim_create_autocmd('CursorHold', { - pattern = '*.tex', - callback = forward_search, - }) - end, }, }