Giter Club home page Giter Club logo

Comments (5)

lervag avatar lervag commented on August 16, 2024

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?

from vimtex.

thekswenson avatar thekswenson commented on August 16, 2024

Sorry @lervag, I updated the post to say <tab>.

from vimtex.

lervag avatar lervag commented on August 16, 2024

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

from vimtex.

thekswenson avatar thekswenson commented on August 16, 2024

Thanks a ton for the very clear explanation of the problem, and the fix!

from vimtex.

lervag avatar lervag commented on August 16, 2024

No problem 😊

from vimtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.