1

I just got Latex-suite properly installed and working, except when I do :help latex-suite.txt I get:

"latex-suite.txt" [readonly] 3474L, 151620B Error detected while processing modelines: line 3473: E992: Not allowed in a modeline when 'modelineexpr' is off: foldtext=substitute(v:folddash es.substitute(getline(v:foldstart),'\s*\.',"",""),'^--','\ \ \ \ \ \ ','') Press ENTER or type command to continue

When I press enter vim splits into two and the help file is loaded. Very cool, except that annoying error message. What is going on and how can I eliminate E992? It appears to be near the end of that file, assuming there is something at line 3473 that vim does not like. I've tried researching keyword modeline, and I examined the end of that *.txt file, but it makes no sense. I don't know enough about vim's internals to understand what is going on.

perlboy
  • 11
  • 2
    I’m voting to close this question because setting up Vim is not really part of what this site is for. – Thruston May 23 '21 at 20:47

1 Answers1

-1

In options.txt for Vim version 8.2 can be found the following:

E992

No other commands than "set" are supported, for security reasons (somebody might create a Trojan horse text file with modelines). And not all options can be set. For some options a flag is set, so that when the value is used the sandbox is effective. Some options can only be set from the modeline when 'modelineexpr' is set (the default is off).

There seem to be a great many options in Latex-Suite that can be set from the modeline, if it is enabled, and I can't imagine its authors have created a Trojan horse, and ~/.vim/doc/latex-suite.txt has three modeline expressions on its last three lines. Without set modelineexpr on you get that E992 message when asking for latex or latex-suite help in vim. However, this option is not known outside latex-suite, at least not in the way I use vim, so just enabling it in .vimrc creates error warnings when using vim to edit non-tex files, such as .vimrc itself. I use vim for a great many editing tasks other than LaTeX document creation, in fact, I am embarking on using vim in this manner for the first time, comparing it with TexShop and texmaker to see which I prefer (I volunteered as a math tutor at a local community college.) I hate error and warning messages, especially after an install. They assert something is very wrong, either with the install or with the package. I won't use a product until all of the early error or warning messages are eliminated, and at some point I'm going to have to guide my students through an install of whichever product I choose. In addressing this problem I discovered Vimscript. Man, is that implementation impressive. emacs, you have finally met your match!

So, to solve the E992 problem in latex-suite, and to prevent a related problem when using vim for Perl or C, I added this Vimscript expression to my .vimrc, to wit:

" This conditional is needed to suppress E992 error in latex-suite.
if &filetype ==# 'plaintex'
    set modelineexpr on
endif

plaintex is the filetype vim assigns to *.tex files.

If Latex-suites' authors, or any other vim/tex gurus think this is a stupid solution, please comment. I can imagine a <leader> key mapping to toggle this option on and off, except I'm happy with my solution. It's very visible, whereas that command would not be, and one would have to remember to toggle it on before asking for help. Otherwise, I will mark this problem solved at the appropriate time.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
perlboy
  • 11
  • 1
    Setting up vim can be hard and there is a dedicated site on stackexchange, where you can get {better,quicker} help: https://vi.stackexchange.com/ – DG' May 23 '21 at 17:52
  • You might like to delete this from the above: Waiting for an answer here is like Waiting for Godot... --- it doesn't really encourage anyone to help you. – Thruston May 23 '21 at 20:51