Closed sanjayankur31 closed 4 years ago
Have you updated your plugins recently? As far as I've understood, vim-polyglot should not do anything for LaTeX, and so this should not be a problem.
Yes, I ran a vim -c PlugUpdate
recently. Both vimtex and polyglot are at the current commits:
I had the same impression about polyglot. I read in some issues here that vim-polyglot no longer supplies tex files and so should not interfere with vimtex, but this is what i found. Perhaps it's a bug in polyglot then---it still loads the default tex file provided by vim somehow which then interferes with vimtex?
Perhaps it's a bug in polyglot then---it still loads the default tex file provided by vim somehow which then interferes with vimtex?
Yes, this has to be a bug with polyglot. Notice in particular #1790 and @sheerun's comment. Perhaps @sheerun could comment on this?
I've described problem and possible solution at https://github.com/sheerun/vim-polyglot/issues/580
In short autoload files are loaded in the order they are defined in .vimrc, that is vim-polyglot tex.vim
autoload files are loaded before (or rather instead of) vimtex's tex.vim
files. The solution is to reverse order in .vimrc to:
Plug 'sheerun/vim-polyglot'
Plug 'lervag/vimtex'
but best solution would be for vimtex to switch from tex
filetype to vimtex
filetype (i.e. create ftdetect/vimtex.vim
file that does au BufNewFile,BufRead *.bbl,*.dtx,*.latex,*.ltx,*.sty set ft=vimtex
, and then rename all tex.vim
files to vimtex.vim
files.
this would also solve issues with vim8 packages that you describe in the readme
Plug 'sheerun/vim-polyglot' Plug 'lervag/vimtex'
Just a note: this should be the other way around. I.e., vim-polyglot should be loaded last.
but best solution would be for vimtex to switch from
tex
filetype tovimtex
filetype (i.e. createftdetect/vimtex.vim
file that doesau BufNewFile,BufRead *.bbl,*.dtx,*.latex,*.ltx,*.sty set ft=vimtex
, and then rename alltex.vim
files tovimtex.vim
files.
No! I don't agree. The best solution would be for vim-polyglot to stop adding tex.vim
scripts!
People should learn to understand what they are doing. If people use vim-polyglot, they are adding a huge amount of filetype specific scripts that may or may not conflict with other plugins. In this particular case, it obviously conflicts with vimtex. Vimtex implements a filetype plugin (and hopefully in near future syntax plugin) for LaTeX files, and there should be no reason to not override the tex
filetype. The plugin clash is not caused by vimtex, but by vim-polyglot. So, back to where I started: if people combine vim-polyglot with vimtex, they should understand what they are doing. The problem is not caused by vimtex, and so I will make no change to vimtex for this issue.
tex.vim scripts are in vim upstream as well
Yes, but they don't create trouble for vimtex from the looks of it. At least that's what my MWE indicates.
tex.vim scripts are in vim upstream as well
That's not relevant. Vim provides a set of runtime scripts by default. These are essentially just bundled scripts and plugins, including syntax scripts and filetype plugins. The entire point of plugin managers such as vim-plug is to update the runtimepath such that installed plugins are prioritized ahead of the intrinsic bundled plugins. Specifically, the first paths in &runtimepath
are prioritized, so e.g. vim-plug will insert the plugin directories at the beginning of the runtimepath. The after
directories are correspondingly placed at the end.
As far as I can understand, vim-polyglot aims to be sort of an improved runtime that i) adds support for a lot more filetypes and ii) improves the support for some filetypes. This means that it should be loaded so as to not disturb other more specific filetype plugins such as vimtex. IMHO, it is up to vim-polyglot to instruct its users how to properly install the plugin so that it does not interfere with other plugins. In particular, vim-polyglot should not be put early in the runtimepath. With vim-plug, it should be the last (or one of the last) plugins to be loaded.
Again, IMHO, the problem is not with vimtex. The solution is not to change vimtex.
Vim recommends for plugins to not be dependent on loading order: https://github.com/vim/vim/issues/7056
Actually vim-polyglot depends very much to be put first in runtime path: https://github.com/sheerun/vim-polyglot/issues/571
I understand at this point I can't change your mind, but the same way I could say your plugin conflicts with mine. Until I figure out how to hack this, the workaround is as described above (change order of vimtex and vim-polyglot).
(depends very much to be put first in runtime path == it was the case, now it's just more performant if loaded first)
by the way in the readme you write "Please note that by default Vim puts custom /start/ plugin directories at the end of the &runtimepath. This means the built in filetype plugin is loaded, which prevents Vimtex from loading. See #1413 for two suggested solutions to this. To see which scripts are loaded and in which order, use :scriptnames.". It's very the same "issue", but without vim-polyglot. I don't believe I should remove tex.vim from polyglot.
I understand at this point I can't change your mind, but the same way I could say your plugin conflicts with mine. Until I figure out how to hack this, the workaround is as described above (change order of vimtex and vim-polyglot).
Yes, I understand that you may have the opposite view from me here. And of course, I don't mean to be rude to you in any way.
by the way in the readme you write "Please note that by default Vim puts custom /start/ plugin directories at the end of the &runtimepath. This means the built in filetype plugin is loaded, which prevents Vimtex from loading. See #1413 for two suggested solutions to this. To see which scripts are loaded and in which order, use :scriptnames.". It's very the same "issue", but without vim-polyglot. I don't believe I should remove tex.vim from polyglot.
Yes, you are right. I think this quote from the README file may be irrelevant now, though, cf. @clason's comment in #1413.
I don't really care so much what you do with vim-polyglot, since I'm not using it myself, but I am curious what is the difference between the content of tex.vim
in vim-polyglot from the versions provided by Vims runtime?
it is the same if you're using the most recent vim. it is only useful if you must use old vim, but you'd like the newest syntax highlighting
(but in the future I could decide to replace it with something better)
Issue If vimtex is loaded after vim-polyglot, it will not load at all.
This isn't a bug in vimtex, but I guess it needs to be noted somewhere that vimtex should be loaded before vim-polyglot. I'll be happy to file a bug against vim-polyglot if that would be preferred too.
minimal.vim
vimtex does not load:
vimtex will load correctly:
minimal.tex
Commands/Input If vim-polyglot is listed/loaded before, vimtex commands are not available in vim at all. One cannot even run
:VimtexInfo
Observed Behaviour It looks like loading of vim-polyglot first prevents loading of vimtex (see the attached files).
Expected Behaviour vimtex should load correctly
Output from VimtexInfo NA
doesn-not-work-scriptnames.txt works-scriptnames.txt
Other information: