vimtex-follow
August 2, 2026 ยท View on GitHub
Toggleable "follow PDF" for VimTeX: while active, the PDF viewer follows the line your cursor is on.
How it works
- Each sync runs
silent! VimtexView, but only if the line actually changed and is not blank, to try and avoid redundant forward searches. - By default a
CursorMovedautocmd is used with a short trailing debounce. This can be more resource intensive, but feels more snappy. (works best with a light weight viewer like zathura) - The alternative
trigger = 'hold'usesCursorHold, which means the PDF only syncs after staying on a line for a while, so it is synced less often (e.g. during rapid scrolling). Less snappy but more efficient.CursorHoldfires afterupdatetimems of idling, so lowerupdatetimeyourself (e.g.set updatetime=150) to make it snappier.
Requirements
- Neovim >= 0.10
- vimtex with a configured
vim.g.vimtex_view_method(e.g.'sioyek')
Installation (lazy.nvim)
{
'itsfernn/vimtex-follow',
dependencies = { 'lervag/vimtex' },
lazy = false,
config = function()
require('vimtex-follow').setup()
end,
}
The plugin only needs to be active when you use the toggle; it does nothing until you enable it for a buffer.
Usage
<leader>lftoggles follow mode for the current buffer (default keymap, disabled withsetup({ keymap = false })).:VimtexFollowToggle,:VimtexFollowEnable,:VimtexFollowDisable:VimtexFollowSyncrunsVimtexViewonce at the current line.
Options
require('vimtex-follow').setup({
keymap = '<leader>lf', -- toggle keymap, or `false` to disable
trigger = 'moved', -- 'moved' (CursorMoved, debounced) or 'hold' (CursorHold)
debounce = 50, -- ms cursor must stay on a line before syncing ('moved'); 0 = every line
notify = true, -- notifications on toggle
})
See :help vimtex-follow for details.