Skip to content

Conversation

@leo-leesco
Copy link
Contributor

@leo-leesco leo-leesco commented Aug 10, 2025

I implemented the modifications suggested by griffinwxk in #2835. Nothing much, but it seems that this was what was broken.

There is still some work to do (at least on my computer, forward search is a bit strange, I have two previews open on startup and SyncTex only seems to work on one of the previews). Thought I should also mention that, inside TexShop, Settings > PDF Preview > External editor > Automatic preview update should be toggled on.

Thanks for the great plugin!

@leo-leesco
Copy link
Contributor Author

leo-leesco commented Aug 10, 2025

Maybe another comment, I don't really know where to put that, but a "correct" configuration for using TexShop could be :

return {
  "lervag/vimtex",
  lazy = false,
  build = function()
    os.execute("defaults write TeXShop OtherEditorSync YES")
    os.execute("defaults write TeXShop UseExternalEditor -bool true")
    os.execute("sudo mkdir -p /usr/local/bin/")

    local tmp_path = "/tmp/othereditor"
    local f = io.open(tmp_path, "w")
    assert(f, "Failed to open temp file for writing")
    f:write([[nvim --headless -c "VimtexInverseSearch $1 '$2'"]])
    f:close()

    local othereditor = " /usr/local/bin/othereditor"
    os.execute("sudo mv " .. tmp_path .. othereditor)
    os.execute("sudo chmod +x" .. othereditor)
  end,
  init = function()
    -- VimTeX configuration goes here, e.g.
    vim.g.vimtex_view_method = "texshop"
    vim.g.vimtex_view_texshop_activate = 0
  end
}

Not sure if it works completely as intended (I did the modifications manually) but trying out something like that should correspond to the docs

@leo-leesco leo-leesco changed the title implement #2835 implement #2835 : TexShop preview Aug 10, 2025
@lervag
Copy link
Owner

lervag commented Aug 11, 2025

I implemented the modifications suggested by griffinwxk. Nothing much, but it seems that this was what was broken.

There is still some work to do (at least on my computer, forward search is a bit strange, I have two previews open on startup and SyncTex only seems to work on one of the previews). Thought I should also mention that, inside TexShop, Settings > PDF Preview > External editor > Automatic preview update should be toggled on.

Great, thanks! As I don't use neither MacOS nor TeXShop I will have to take your word for it that this indeed works as expected. I have no means of testing it myself.

So, let me know when you want me to consider it for merging.

Thanks for the great plugin!

Glad you like it!

Maybe another comment, I don't really know where to put that, but a "correct" configuration for using TexShop could be: …

Well, I really don't like a suggestion that asks users to run commands with sudo. I think instead we should ask people to create a local script e.g. under $HOME/.local/bin/othereditor and to make it executable with chmod +x. We could write about this in the docs under :help vimtex-view-texshop. There we could also suggest that people do the defaults write ... commands.

@leo-leesco
Copy link
Contributor Author

Alright, I fixed the problem (my LSP config was wrong and fired two instances of the LSP seems like) !
You can merge :)

@leo-leesco
Copy link
Contributor Author

about the config, I just wanted to maybe suggest something that was plug and play, but I agree that asking for sudo commands might be a stretch
It's well documented in the help files, so no need to change anything else
thanks !

lervag added a commit that referenced this pull request Aug 23, 2025
@lervag
Copy link
Owner

lervag commented Aug 23, 2025

Cool, thanks! I've merged this locally now. Thanks for the contribution!

@lervag lervag closed this Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants