Issue
Running Neovim v0.4.3 on Ubuntu 20.04
When I add
call deoplete#custom#var('omni', 'input_patterns', {
\ 'tex': g:vimtex#re#deoplete
\})
call deoplete#custom#option({
\ 'auto_complete_delay': 200,
\ 'smart_case': v:true,
\ })
in the minimal configuration below I receive the warning
Error detected while processing /home/evanhorn/.config/nvim/minimal.vim:
line 14:
E121: Undefiend variable: g:vimtex#re#deoplete
E116: Invalid arguments for function deoplete#custom#var
line 19:
E117: Unknown function deoplete#custom#option
Error detected while processing function vimtex#init[3]..<SNR>115_init_state[1]..vimtex#state#init[1]..<SNR>118_get_main[16]..<SNR>118_get_main_from_texroot:
line 2:
E121: Undefiend variable: g:vimtex#re#tex_input_root
E116: Invalid arguments for function matchstr
E15: Invalid expression: matchstr(l:line, g:vimtex#re#test_input_root)
Error detected while processing function vimtex#init[3]..<SNR>115_init_state[1]..vimtex#state#init:
line 1:
E714: List required
Error detected while processing /home/evanhorn/.config/nvim/pack/minpac/start/vimtex/indent/tex.vim:
line 105:
E121: Undefiend variable: g:vimtex#re#not_bslash
E15: Invalid expression: g:vimtex#re#not_bslash . '\&'
line 106:
E716: Key not present in Dictionary: re_amp
E15 Invalid expression: '^[ \t\\'*' . s:indent_amps.re_amp
Press ENTER or type command to continue
If I leave out the deoplete(s) call then no errors occur.
This issue seems related to this and this, but as I am not using vim-plug neither of those solutions seem applicable to my situation.
If I add a line to source vimtex/autoload/vimtex/re.vim then the "Undefined variable" error vanishes so there appears to be something preventing that from being sourced. I do also get another E117 error that deoplete#custom#var is unknown, but as that seems to be related to deoplete it is probably beyond the scope of vimtex and I will ask about that elsewhere.
minimal.vim
```vim
set nocompatible
set shell=/bin/bash
let g:python3_host_prog = expand("$HOME/.virtualenvs/neovim/bin/python")
let g:tex_flavor = 'latex'
let g:deoplete#enable_at_startup = 1
call deoplete#custom#var('omni', 'input_patterns', {
\ 'tex': g:vimtex#re#deoplete
})
call deoplete#custom#option({
\ 'auto_complete_delay': 200,
\ 'smart_case': v:true,
\ })
```
Note: pynvim, and msgpack are install in the virtual environment.
minimal.tex
tex
\documentclass{minimal}
\begin{document}
Hello world!
\end{document}
In addition to the above files, I temporarily removed all of my plugins from the pack folder except for minpac, deoplete, and vimtex.
Output from VimtexInfo
System info
OS: Ubuntu 20.04.1 LTS
Vim version: NVIM v0.4.3
Has clientserver: true
Servername: /tmp/nvimB8ROKQ/0
vimtex project: minimal
base: minimal.tex
root: /home/evanhorn/.config/nvim
tex: /home/evanhorn/.config/nvim/minimal.tex
out:
log:
aux:
fls:
main parser: current file verified
compiler: latexmk
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
latexmk engine: -pdf
viewer: Zathura
xwin id: 0
qf: LaTeX logfile
addqflist: 58
fix_paths: 59
set_errorformat: 57
document class: minimal
Your configuration is invalid.
Because you don't have runtimepath settings in the vimrc.
You need to upload the real minimal vimrc.
You may install plugins in ~/.vim directory. You should not do it and it is hard to test by other people.
In addition to the above files, I temporarily removed all of my plugins from the pack folder except for minpac, deoplete, and vimtex.
I get it. So this is feature of packadd.
Please read the issue.
https://github.com/wbthomason/packer.nvim/issues/4
You have installed deoplete in pack directory from my ESP skills(why don't you describe the situation??).
You need to load deoplete before calling.
I thought I was describing the situation when I stated that I removed everything from the pack folder except minpac, deoplete, and vimtex. My apologies for not being more specific.
Anyway, thank you for your assistance and for your great plugins. Your comment helped me realize that I was assuming that the packages would be loaded as part of the initial startup, i.e., before init.vim was run (why I thought this I have no idea - the documents clearly state that packages are loaded after .vimrc or init.vim are sourced). By adding packloadall before the plugin configurations it works great aside from a message that says "Already loaded".
I am adding the working minimal init.vim for anyone else that may be looking for a solution to this problem.
set nocompatible
set shell=/bin/bash
let g:python3_host_prog = expand("$HOME/.virtualenvs/neovim/bin/python")
let g:tex_flavor = 'latex'
let g:deoplete#enable_at_startup = 1
packloadall
call deoplete#custom#var('omni', 'input_patterns', {
\ 'tex': g:vimtex#re#deoplete
\})
call deoplete#custom#option({
\ 'auto_complete_delay': 200,
\ 'smart_case': v:true,
\ })
Vim's packadd behavior is cleary from package manager author.
But it may be confusing from other package manager user.
Sorry, I don鈥檛 understand the meaning of the previous comment. If it鈥檚 regarding my original message then yes, I agree that I could have written it with more clarity.
You can add deoplete as opt package and load it in init.vim instead.
Happy to see this is resolved! Thanks for pitching in, @Shougo!
I thought I was describing the situation when I stated that I removed everything from the pack folder except minpac, deoplete, and vimtex. My apologies for not being more specific.
I've helped several people with issues relating to package management with the package feature. It seems people don't fully read the docs, that is, :help packages. Although I understand the docs may be confusing, it is also clearly important that one understands the mechanisms since one insists on avoiding the much simpler path of using the plugin based managers (such as vim-plug).
In you original description, what was missing was a simple listing of your package path. You say you removed everything from the pack folder, but you did not list the actual pack folder. It would still be important e.g. to note whether you've put e.g. vimtex under /opt instead of /start (a common mistake).
Ah, yes, the directory structure could definitely make a difference. I鈥檓 sure it gets old answering questions like mine that are systemic issues and not actually about your products.
Sometimes it鈥檚 easy to miss the forest for the trees - I was so focused on the order of the packages and potential package conflicts that I was oblivious to when they were actually getting loaded. Thanks to both of you for your patience and support.
Ah, yes, the directory structure could definitely make a difference. I鈥檓 sure it gets old answering questions like mine that are systemic issues and not actually about your products.
Yes. But still, everyone has to start somewhere, and I would be surprised if not every single expert out there started out making "rookie mistakes".
Sometimes it鈥檚 easy to miss the forest for the trees - I was so focused on the order of the packages and potential package conflicts that I was oblivious to when they were actually getting loaded. Thanks to both of you for your patience and support.
No problem. Happy to hear it works, and feel free to open new issues.
Most helpful comment
I thought I was describing the situation when I stated that I removed everything from the pack folder except minpac, deoplete, and vimtex. My apologies for not being more specific.
Anyway, thank you for your assistance and for your great plugins. Your comment helped me realize that I was assuming that the packages would be loaded as part of the initial startup, i.e., before init.vim was run (why I thought this I have no idea - the documents clearly state that packages are loaded after .vimrc or init.vim are sourced). By adding
packloadallbefore the plugin configurations it works great aside from a message that says "Already loaded".I am adding the working minimal init.vim for anyone else that may be looking for a solution to this problem.