Closed thekswenson closed 3 months ago
I get "We don’t support that file type." messages, so I'm not sure how to attach the minimal example files. I'll do so in comments.
Yes, I much prefer that you include the files verbatim; preferably as part of the main post.
In your "step 2", the sentence ends after "and press"... so, press what?
Sorry @lervag, I updated the post to say <tab>
.
Ok, I tried to reproduce this. I did:
mkdir test
cd test
git clone https://github.com/ervandew/supertab
vim test.vim
vim test.tex
The contents of test.tex
is the same as what you provided, whereas I simplified the test.vim
file to this:
set nocompatible
set runtimepath^=~/.local/plugged/vimtex
set runtimepath^=supertab
set runtimepath+=~/.local/plugged/vimtex/after
filetype plugin indent on
syntax enable
nnoremap q :qall!<cr>
silent edit test.tex
Now, finally, I run vim --clean -u test.vim
, which will open the test.tex
file with VimTeX and supertab enabled. I start typing a word (in the document) and complete with <tab>
, and I can see the delay you mention.
The delay is caused by VimTeX indirectly, because VimTeX will set the 'include'
option. You can inspect its value with :set include
after opening a LaTeX file. Now, what is happening is that keyword completion (CTRL-N
), which is executed by supertab with <tab>
, will scan for keywords from included files. This is the default behaviour in Vim. Notice that Neovim has changed this default. It is controlled by the 'complete'
option:
*'complete'* *'cpt'* *E535*
'complete' 'cpt' string (default: ".,w,b,u,t,i")
local to buffer
This option specifies how keyword completion |ins-completion| works
when CTRL-P or CTRL-N are used. It is also used for whole-line
completion |i_CTRL-X_CTRL-L|. It indicates the type of completion
and the places to scan. It is a comma-separated list of flags:
. scan the current buffer ('wrapscan' is ignored)
w scan buffers from other windows
b scan other loaded buffers that are in the buffer list
u scan the unloaded buffers that are in the buffer list
U scan the buffers that are not in the buffer list
k scan the files given with the 'dictionary' option
kspell use the currently active spell checking |spell|
k{dict} scan the file {dict}. Several "k" flags can be given,
patterns are valid too. For example: >
:set cpt=k/usr/dict/*,k~/spanish
< s scan the files given with the 'thesaurus' option
s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns
are valid too.
i scan current and included files
So, I think you can remove the lag if you remove i
from the complete option, i.e. add this to your vimrc:
set complete-=i
Thanks a ton for the very clear explanation of the problem, and the fix!
No problem 😊
Description
When I want to retype a long word that is already in my document, I press
<tab>
, using the supertab plugin. With vimtex enabled, it takes ~20 seconds to search all of the system tex libraries before showing the list of completions.I'm filing a bug because this seems like it shouldn't be normal behavior. If it is normal, I'll close the bug. In that case, is there a workaround to get vimtex to stop searching ALL of the
.sty
(etc.) files on my system?Steps to reproduce
<tab>
Expected behavior
I expect a list of completions to show up in a reasonable amount of time.
Actual behavior
The list shows up after almost 20 seconds.
Do you use a latexmkrc file?
No
VimtexInfo