Closed DaitiDay closed 3 months ago
As for the title, inverse search works fine (I'm using sioyek). The cursor gets put to the correct location in vim, but the terminal does not get focused. Following the suggestion in #2579 I've tried to add the following autocommand to my neovim config:
local group = vim.api.nvim_create_augroup('vimtex', { clear = true }) vim.api.nvim_create_autocmd('VimtexEventViewReverse', { command = "call b:vimtex.viewer.xdo_focus_vim()", group = group })
with no success. Anyone can help me pointing out what I'm doing wrong?
Yes, sure. The problem is that the autocommand is not correct. Try this:
local group = vim.api.nvim_create_augroup('vimtex', {})
vim.api.nvim_create_autocmd('User', {
pattern = 'VimtexEventViewReverse',
group = group,
command = "call b:vimtex.viewer.xdo_focus_vim()"
})
The point is that VimtexEvent...
is a pattern for the User
event. Notice, you don't need clear = true
, since it is the default.
It works 😄 thank you for the help. I had to change the command cause my window manager wasn't switching focus with certain layouts, but the pattern
key fixed the main problem. I'll close the issue as solved but I suggest that the autocmd snippet be added to the documentation. Thank you again 👍🏻
It works 😄
Great, I'm glad to hear it!
thank you for the help.
No problem :)
I had to change the command cause my window manager wasn't switching focus with certain layouts, but the
pattern
key fixed the main problem. I'll close the issue as solved but I suggest that the autocmd snippet be added to the documentation.
I've added a couple of snippets to the event examples. Let me know if you think it is not good enough ;)
Description
As for the title, inverse search works fine (I'm using sioyek). The cursor gets put to the correct location in vim, but the terminal does not get focused. Following the suggestion in #2579 I've tried to add the following autocommand to my neovim config:
with no success. Anyone can help me pointing out what I'm doing wrong?
Steps to reproduce
Not relevant.
Expected behavior
Clicking on text in sioyek should switch focus to the terminal and put the cursor on the correct line in the tex file.
Actual behavior
The cursor gets put on the correct line in the tex file but the terminal does not get focus.
Do you use a latexmkrc file?
no
VimtexInfo