vim.cmd([[set runtimepath=$VIMRUNTIME]]) vim.opt.runtimepath:append('.') vim.opt.packpath = {} vim.opt.loadplugins = false require('preview.commands').setup() vim.fn.serverstart('/tmp/nvim-preview.sock') local synctex_pdf = {} vim.api.nvim_create_autocmd('User', { pattern = 'PreviewCompileSuccess', callback = function(args) synctex_pdf[args.data.bufnr] = args.data.output end, }) vim.g.preview = { latex = { open = { 'zathura', '--synctex-editor-command', 'nvim --server /tmp/nvim-preview.sock' .. [[ --remote-expr "execute('b +%{line} %{input}')"]], }, }, } vim.keymap.set('n', 's', function() local pdf = synctex_pdf[vim.api.nvim_get_current_buf()] if pdf then vim.fn.jobstart({ 'zathura', '--synctex-forward', vim.fn.line('.') .. ':0:' .. vim.fn.expand('%:p'), pdf, }) end end)