-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vimtex#init() not called #1413
Comments
The problem here is that for some reason, vimtex is not properly loaded. My guess is that it is because you are not loading it properly with the new Or, perhaps this is all intended, and your goal is to only use the omnicomplete function from vimtex and ignore everything else? |
Are you sure you should not put something of this in the |
Thanks, I want most of vimtex's features though. Vim finds the plugin, and I'm interested to know what a "properly loaded" plugin means. Vimtex appeared to be "properly loaded" until a while ago (using minpac). I also have no minpac issues with my other ftplugin's. Using If I add the checks from |
I've created test files similar to your script:
With set nocompatible
set runtimepath+=.
filetype plugin indent on
syntax enable
packadd vimtex If I start with However, with the
As I have no experience with the |
@lervag In this case, |
Huh, OK. I read
So I looked at |
When I add |
I notice that |
Ok, so, some progress. When vimtex is loaded through the With the "old style" plugin managers, e.g. vimplug, I also noticed that |
Ok, now I'm far enough. The problem is as stated above: When vimtex is loaded with IMHO, this is not a vimtex issue. If you want to use vimtex, you should ensure that it is loaded before the My advice would be to open an issue with minpac. Perhaps something may be done on that end, or perhaps someone there knows a workaround. |
It would be possible to add a function function! vimtex#pack_install() abort " {{{1
if !exists('s:sfile')
return
endif
let l:path = fnameescape(fnamemodify(s:sfile, ':h:h'))
unlet s:sfile
execute 'set rtp-=' . l:path
execute 'set rtp^=' . l:path
endfunction
let s:sfile = expand('<sfile>')
" }}}1 Though the user would then have to do: packadd! vimtex
call vimtex#pack_install() or au FileType tex ++once call vimtex#pack_install()
|
@andymass Thanks for the suggestion. I've mentioned this in the README file now with a link here for anyone who needs a solution. |
thanks for the suggestions! Though, I'd like to know your opinion on the (somewhat unrelated, and possibly edge-case) problem with a plugin's runtimepath in front of Should there be an ps: vim-packager also uses the pack feature |
I think you raise an interesting question here. Personally, I've tried to prepend I really don't think there is much hope in altering the behaviour of the vim plugin community, that is, I don't think plugin authors will start to move their docs to In any case, it is helpful to read the |
@andymass Can you please explain I would implement this? Where do I put this code block? How can I make sure it's called every time I run Vim? I have Vim 8.1 running with some plugins installed natively, but I'm not experienced in coding. |
@leonorbert, @lervag Unfortunately that snippet has to go inside the file with vimtex#init so it isn't really something that can be used within a vimrc. |
@leonorbert If you're fine with the "wrong" order of vimtex in the runtimepath, just call if exists("b:did_user_ftplugin") | finish | endif
let b:did_user_ftplugin = 1
" If it's in opt/
packadd! vimtex
if get(g:, 'vimtex_enabled')
call vimtex#init()
endif |
Perhaps I came to this thread because of the link in the README about the native installation method. The two other plugins I have in Sorry if I'm missing something basic on installation methods. I did try Pathogen to install |
I never used vim on windows. I don't think your |
@leonorbert Feel free to open a new issue if necessary; if so, please follow the issue template and provide all relevant context. |
So it was something basic after all. Sorry! I got this working fine with the default installation method after reading through more of the Vim documentation on file types and plugins. You may want to alter the
But at least I can say that the runtime paths are in the correct order with the default Vim package installation on Windows 8.1. I'm happy to have this TeX working environment, thank you for all of your development work! I'm still having an issues with window focus and forward/inverse search to SumatraPDF, similar to #680 and #1495. I'll experiment with it more and post on #1495 if I can't figure it out. |
I don't mind altering, but I would much appreciate any concrete suggestions. To me it seems quite clear that Vimtex loads on
Yes, but this is also quite clearly stated in all documentation. Also, today it is quite normal to use a plugin manager such as vim-plug, which should handle this automatically. Again, feel free to suggest a change to the README.
I'm happy to hear things work, and thanks for the feedback! |
Well, my problem was not knowing about file type plugins, until I went through the Vim documentation more thoroughly. I found that and the helptags, but a pointer in the right direction would have saved me time. Vim has a lot of information to take in! Since I was installing plugins for the first time, it seemed like a native installation method was simpler than a plugin manager. In case there are other novice users out there who come to your page, the following More about this bug report I could be misunderstanding the issues in this thread, but for me following the setup directions in Even I did reproduce this bug by using a custom Maybe you know how to use
set packpath=~/Backup,~/vimfiles . . .
set rtp=~/Backup,~/vimfiles . . .
(Because of Windows, I had to change all backslashes in the paths to forward slashes and escape the spaces with preceding backslashes. Otherwise Vim could not read the vimrc.) If this works for other Vim setups, you could put something about it in the Suggested README additionsInstallationIf you use vim-plug, then add the Plug 'lervag/vimtex' Or use some other plugin manager: If you use the new native package installation feature in Vim 8 (
|
Thanks for the writeup and suggested change to the README. Personally, I don't really see why anyone really wants to use the native feature. Using |
You're welcome, I learned a lot by working through it. I'll try out FYI, you have one typo in your update, "ifletype " instead of "filetype." I don't know if you meant to disable the link to this thread, either. Again, thanks for you all work on this plugin. |
Thanks for noticing the typo and the missing link!
My pleasure. I find it is a very nice hobby. It is fascinating how many different types of challenges there are in writing and maintaining a plugin like this. |
Hi, There is something I noticed: if there is some delay between the g:vimtex_imaps_leader '`' and the character, the imaps characters won't expand. So the users should ensure that the leader and the characters are typed in quick succession. |
No problem, thanks for the kind words! :)
Yes, this is standard Vim behaviour. See |
Is there any update/clarification on this? I'm currently trying to migrate to the native plugin/packaging solution. My main motivation was to be able to use echo "packadd! vimtex" > minimal.vim
vim -u minimal.vim test.tex ^ This works perfectly fine, as far as i can tell. vim -u NORC test.tex
:packadd! vimtex
|
Vimtex needs to be properly loaded before you open a tex file. That is, your runtimepath must include vimtex so that the filetype plugin is detected. This explains why your second example does not work. The proper way of adding vimtex with the package feature, as far as I understand, is to add it to some path that loads vimtex on vim startup. With "load", I only mean that the runtimepath must include vimtex. You should ensure vimtex is available inside your |
Yes, I think I understand now. Essentially having things in
This seems to be inaccurate, since vimtex does in fact load without any workarounds when putting it either in Also, now that I think about it, simply having everything in
|
Why unfortunately? There is no reason to do this. The point of I don't use the package feature myself, and so the docs/readme may be somewhat inprecise, sorry. Feel free to suggest an update!
This is again unecessary for the same reasons. But it should work, I think; not sure. |
Just to follow-up, Greg Hurrell mentioned the ftdetect caveat with |
@lervag I've recently started using (neo)vim's native package feature (using the new https://github.com/wbthomason/packer.nvim). I have it put vimtex into the
|
Thanks, interesting to know. Was not aware about packer.nvim. |
@clason do you know what packer.nvim is actually doing on the "use {plugin}" command? Maybe it adjusts the runtimepath? |
@andymass It does not; that is handled by the underlying native package mechanism; this is a major difference to
|
I think the best solution would be for vimtex to use |
Why is that? Why does vim-polyglot bundle the the plugin by Benji Fisher, presumably the same script that ships with Vim by default? IMHO, vimtex should not do anything; instead, vim-polyglot should simply remove the If there continues to be a conflict here, then I might consider to add a check for vim-polyglot and add a warning to users that use vim-polyglot to disable the latex part. |
Ok, this issue is now discussed at #1822. I'm therefore locking this thread. |
Describe the issue
Upon omni completion, various errors pop up, depending on my setup. In the test script below, it's
E121: Undefined variable: g:vimtex_complete_close_braces
. The issue is thatvimtex#init()
is not called.Steps to reproduce
I keep the vimtex repo in
~/.local/share/nvim/site/pack/github/start
, managed with minpac. Run the below script, and try omni completion.I probably overlooked something...
The text was updated successfully, but these errors were encountered: