Skip to content
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

Add g:vimtex_include_search_enabled option #1358

Closed
wants to merge 7 commits into from

Conversation

Projects
None yet
2 participants
@9999years
Copy link
Contributor

9999years commented Apr 6, 2019

Adds the g:vimtex_include_search_enabled option, which allows the user to prevent Vimtex from shelling out to kpsewhich to find the names of included files; this can cause large slowdowns when using plugins that scan included files like Supertab.

Also adds a section to the FAQ, “Problem: Pressing causes Vim to hang when using Supertab or similar.”

Future work: Currently, Vimtex shells out to kpsewhich once for each suffix in suffixesadd: .tex, .sty, and .cls; however, we usually know (based on the including line) what the suffix should be:

  • \usepackage means .sty
  • \documentclass means .cls
  • \include and \input mean .tex (I think?)

If we looked at the rest of the line to take a guess, we would only have to shell out to kpsewhich once the vast majority of the time — however, implementing that would require changing a lot more than this simple option addition.

9999years added some commits Apr 6, 2019

Add g:vimtex_include_search_enabled option
The g:vimtex_include_search_enabled option allows the user to
prevent Vimtex from shelling out to kpsewhich to find the names of
included files; this can cause large slowdowns when using plugins that
scan included files like Supertab [1].

[1]: https://github.com/ervandew/supertab
@lervag

This comment has been minimized.

Copy link
Owner

lervag commented Apr 10, 2019

This looks quite ready for merging. However, I am not sure exactly why it is needed. That is, I've worked on a lot of different and somewhat large projects, and none have really suffered large delays.

I am curious if your suggestion for future work would solve this issue, and that it might make a new option unnecessary?

lervag added a commit that referenced this pull request Apr 10, 2019

@lervag

This comment has been minimized.

Copy link
Owner

lervag commented Apr 10, 2019

I looked into this now and I was able to improve things by quite a lot.

however, we usually know (based on the including line) what the suffix should be

Actually, in general, we don't. That is, when the input v:fname for includeexpr comes from doing e.g. :checkpath or one of the include type commands, then the cursor position is not relevant and it becomes impossible to know what is the including line. At least, I have not figured a good way to do it. A possibility is to alter all of the include regular expressions to include the entire lines, but that seems to be a lot of work for possibly not a lot of gain.

So, the question is now: Does my recent improvements make enough of an improvement, or do you still experience the mentioned slowdowns?

If you still experience this, could you provide an example where this happens?

@9999years

This comment has been minimized.

Copy link
Contributor Author

9999years commented Apr 11, 2019

Good question — I’ll try the new version. For now, here’s a minimal configuration that produces the problem:

vimrc with vim-plug:

set encoding=utf-8
set nocompatible

call plug#begin()
Plug 'ervandew/supertab'
Plug 'lervag/vimtex'
call plug#end()

set completeopt=menu,menuone,longest
set pumheight=10
let g:SuperTabDefaultCompletionType = "<c-n>"
let g:SuperTabContextDefaultCompletionType = "<c-n>"

let g:tex_flavor = 'latex'
let g:vimtex_compiler_enabled=0
let g:vimtex_view_enabled=0
let g:vimtex_quickfix_mode=0

sample.tex:

\documentclass{article}
% load a bunch of packages; doesn't matter which ones, as long as they're not
% in the current directory
\usepackage{xparse}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{ntheorem}
\usepackage{mathtools}
\usepackage{mdframed}
\usepackage{enumitem}
\usepackage{imakeidx}
\usepackage{hyperref}
\begin{document}
% open a new line here (or anywhere) and type x and then press <Tab>
\end{document}

Here’s a clip of it in use (pardon the ugly color scheme, I really disabled every plugin), sped up a bit (the original clip is 34 seconds long):
Slow tab-completion

When I set let g:vimtex_include_search_enabled=0 in my vimrc, the delay between pressing tab and seeing the completion menu is instantaneous (or at least much less than a second).

Support Windows paths in vimtex#kpsewhich#find
Modify `vimtex#kpsewhich#find` to support MikTeX on Windows; (warnings
were erroneously treated as paths and absolute paths weren't detected
properly)
@9999years

This comment has been minimized.

Copy link
Contributor Author

9999years commented Apr 11, 2019

As of 0a770fb it still seems pretty slow. By adding a line to vimtex#include#expr I get an interesting diagnostic:

"
" Search for file with kpsewhich
"
if g:vimtex_include_search_enabled
  for l:file in s:split(l:fname)
    for l:suffix in split(&l:suffixesadd, ',') + ['']
      let l:candidate = s:kpsewhich_find(l:file . l:suffix)
      call add(g:vimtex_includes, l:file . l:suffix . ' -- ' . l:candidate) " <- diagnostic
      if !empty(l:candidate)
        return s:visited.check(l:candidate)
      endif
    endfor
  endif
endif

Then, :let g:vimtex_includes=[] and repeating the experiment above (x<Tab>), I get the following log in g:vimtex_includes:

Very long log output

xparse.sty --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/l3packages/xparse/xparse.sty
expl3.sty --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/l3kernel/expl3.sty
expl3-code.tex.sty -- 
expl3-code.tex.tex -- 
expl3-code.tex.cls -- 
expl3-code.tex --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/l3kernel/expl3-code.tex
ltluatex.sty -- 
ltluatex.tex -- C:/Program Files/MiKTeX 2.9/tex/latex/base/ltluatex.tex
etex.src.sty -- 
etex.src.tex -- 
etex.src.cls -- 
etex.src -- C:/Program Files/MiKTeX 2.9/tex/luatex/hyph-utf8/etex.src
etex.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/etex-pkg/etex.sty
etex.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/etex-pkg/etex.sty
etex.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/etex-pkg/etex.sty
graphics.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/graphics.sty
trig.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/trig.sty
amsmath.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsmath.sty
amstext.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amstext.sty
amsgen.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsgen.sty
amsbsy.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsbsy.sty
amsgen.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsgen.sty
amsopn.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsopn.sty
amsgen.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsgen.sty
amssymb.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsfonts/amssymb.sty
amsfonts.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsfonts/amsfonts.sty
ntheorem.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/ntheorem/ntheorem.sty
ifthen.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/base/ifthen.sty
mathtools.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/mathtools/mathtools.sty
keyval.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/keyval.sty
mhsetup.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/mathtools/mhsetup.sty
amsmath.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsmath.sty
graphicx.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/graphicx.sty
keyval.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/keyval.sty
mdframed.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/mdframed/mdframed.sty
#1.sty -- 
#1.tex -- 
#1.cls -- 
#1 -- 
kvoptions.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/kvoptions.sty
keyval.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/keyval.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
kvsetkeys.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/kvsetkeys.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
etexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/etexcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ifluatex.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/ifluatex.sty
kvoptions-patch.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/kvoptions-patch.sty
etexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/etexcmds.sty
xparse.sty --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/l3packages/xparse/xparse.sty
etoolbox.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/etoolbox/etoolbox.sty
etex.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/etex-pkg/etex.sty
etoolbox.def.sty -- 
etoolbox.def.tex -- 
etoolbox.def.cls -- 
etoolbox.def -- C:/Program Files/MiKTeX 2.9/tex/latex/etoolbox/etoolbox.def
zref-abspage.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/zref-abspage.sty
zref-base.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/zref-base.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
kvsetkeys.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/kvsetkeys.sty
kvdefinekeys.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/kvdefinekeys.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ifluatex.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/ifluatex.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
ifpdf.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty
luatex-loader.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/luatex-loader.sty
makerobust.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/makerobust.sty
etexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/etexcmds.sty
auxhook.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/auxhook.sty
atbegshi.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/atbegshi.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
ifpdf.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty
needspace.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/needspace/needspace.sty
color.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/color.sty
md-frame-0.mdf.sty -- 
md-frame-0.mdf.tex -- 
md-frame-0.mdf.cls -- 
md-frame-0.mdf -- C:/Program Files/MiKTeX
2.9/tex/latex/mdframed/md-frame-0.mdf
md-frame-0.mdf.sty -- 
md-frame-0.mdf.tex -- 
md-frame-0.mdf.cls -- 
md-frame-0.mdf -- C:/Program Files/MiKTeX
2.9/tex/latex/mdframed/md-frame-0.mdf
xcolor.sty --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/xcolor/xcolor.sty
colortbl.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/colortbl/colortbl.sty
array.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/tools/array.sty
pdfcolmk.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/pdfcolmk.sty
etex.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/etex-pkg/etex.sty
xcolor.sty --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/xcolor/xcolor.sty
framed.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/framed/framed.sty
hyperref.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/hyperref.sty
hobsub-hyperref.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/hobsub-hyperref.sty
hobsub-generic.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/hobsub-generic.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ifluatex.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/ifluatex.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
etexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/etexcmds.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ifluatex.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/ifluatex.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
ifpdf.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty
luatex-loader.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/luatex-loader.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
intcalc.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/intcalc.sty
bigintcalc.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/bigintcalc.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
bigintcalc.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/bigintcalc.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
hopatch.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/hopatch.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
ifpdf.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
xcolor-patch.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/xcolor-patch.sty
hopatch.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/hopatch.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
ifpdf.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
keyval.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/keyval.sty
kvsetkeys.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/kvsetkeys.sty
kvdefinekeys.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/kvdefinekeys.sty
pdfescape.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdfescape.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
ifvtex.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifvtex.sty
ifxetex.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/ifxetex/ifxetex.sty
hycolor.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/hycolor.sty
xcolor-patch.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/xcolor-patch.sty
letltxmacro.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/letltxmacro.sty
auxhook.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/auxhook.sty
kvoptions.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/kvoptions.sty
pd1enc.def.sty -- 
pd1enc.def.tex -- 
pd1enc.def.cls -- 
pd1enc.def -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/pd1enc.def
puenc.def.sty -- 
puenc.def.tex -- 
puenc.def.cls -- 
puenc.def -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/puenc.def
psdextra.def.sty -- 
psdextra.def.tex -- 
psdextra.def.cls -- 
psdextra.def -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/psdextra.def
intcalc.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/intcalc.sty
etexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/etexcmds.sty
memhfixc.sty -- 
memhfixc.tex -- 
memhfixc.cls -- 
memhfixc -- 
stringenc.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/stringenc.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
pdfescape.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdfescape.sty
#1.sty -- 
#1.tex -- 
#1.cls -- 
#1 -- 
color.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/color.sty
puvnenc.def.sty -- 
puvnenc.def.tex -- 
puvnenc.def.cls -- 
puvnenc.def -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/puvnenc.def
puvnenc.def.sty -- 
puvnenc.def.tex -- 
puvnenc.def.cls -- 
puvnenc.def -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/puvnenc.def
puarenc.def.sty -- 
puarenc.def.tex -- 
puarenc.def.cls -- 
puarenc.def -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/puarenc.def
color.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/color.sty
nameref.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/nameref.sty
refcount.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/refcount.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
gettitlestring.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/gettitlestring.sty
kvoptions.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/kvoptions.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
color.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/graphics/color.sty
nameref.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/nameref.sty
backref.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/backref.sty
kvoptions.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/kvoptions.sty
kvsetkeys.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/kvsetkeys.sty
ltxcmds.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty
rerunfilecheck.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/rerunfilecheck.sty
kvoptions.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/kvoptions.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
pdftexcmds.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/pdftexcmds.sty
atveryend.sty -- C:/Program Files/MiKTeX
2.9/tex/latex/oberdiek/atveryend.sty
uniquecounter.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/uniquecounter.sty
bigintcalc.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/bigintcalc.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
url.sty --
C:/Users/arvensis/AppData/Roaming/MiKTeX/2.9/tex/latex/url/url.sty
bitset.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/bitset.sty
infwarerr.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/infwarerr.sty
intcalc.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/intcalc.sty
bigintcalc.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/bigintcalc.sty
atbegshi.sty -- C:/Program Files/MiKTeX
2.9/tex/generic/oberdiek/atbegshi.sty
imakeidx.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/imakeidx/imakeidx.sty
xkeyval.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/xkeyval/xkeyval.sty
ifxetex.sty -- C:/Program Files/MiKTeX 2.9/tex/generic/ifxetex/ifxetex.sty
multicol.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/tools/multicol.sty
hyperref.sty -- C:/Program Files/MiKTeX 2.9/tex/latex/hyperref/hyperref.sty

It looks like there's some weird recursive behavior happening here; either way, it blocks input for a looong time — there’s 294 calls to kpsewhich in that log! I wonder if using Vim’s jobs could alleviate some of these problems? On the other hand, Supertab might block anyways.

lervag added a commit that referenced this pull request Apr 11, 2019

lervag added a commit that referenced this pull request Apr 11, 2019

@lervag

This comment has been minimized.

Copy link
Owner

lervag commented Apr 11, 2019

Ok, I can confirm the delay, and there is no need to include Supertab. A normal <c-n> type keyword completion suffices. I've pushed my own test for this now. Also, note that the recent improvements greatly reduces the lag for subsequent completions due to caching (although there is still some lag).

Note: Your way of diagnosing indicates 294 calls to kpsewhich, but in reality it is only about ~100, since many of the calls are cached. I did a similar test by moving the diagnostic inside the s:kpsewhich_find function.

In any case, I agree it is sensible to allow an option to disable the use of kpsewhich in the includeexpr. It is clear that this feature does introduce an inconvenient lag.

I'll make another review of your suggested code, but it'll have to be tomorrow evening, as I need to go to bed now... :)

Show resolved Hide resolved doc/vimtex.txt Outdated
Show resolved Hide resolved doc/vimtex.txt
Show resolved Hide resolved autoload/vimtex/kpsewhich.vim Outdated

9999years added some commits Apr 11, 2019

Added is_abs to check paths, rewords docs
- Factored absolute path check into `vimtex#paths#is_abs` and replaced
  every check I could find with calls to that function.
- Touched up docs to indicate that kpsewhich-slowdown is caused by a
  generic i_CTRL-N keyword completion and not anything specific to
  Supertab.

lervag added a commit that referenced this pull request Apr 12, 2019

@lervag

This comment has been minimized.

Copy link
Owner

lervag commented Apr 12, 2019

Thanks, this PR has now been merged. I appreciate your effort!

One comment: I prefer to keep the git log "orderly", and so I prefer git rebase to git merge. I.e., instead of doing git merge master, do git rebase master to put your branch on top of current master, then do git push -f to force push the updated branch.

In any case, again, thanks!

@lervag lervag closed this Apr 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.