4

VLS's commands such as ^J and F5 do not work always for me inside Vim so how can turn VLS manually or do some other tricks to get VLS working more often? The word "often" could mean that VLS gets triggered with every *.tex -ended file. Also, how can I see whether the VLS is even enabled?

$ cat ~/.vimrc

filetype plugin on
set modeline
set modelines=20

Perhaps related

  1. Help me to write Long LaTeX equations fast with colours and possibly with other aids

  2. http://vim-latex.sourceforge.net/

4
  • you need to have filetype plugin on in your ~/.vimrc file. This should make it work for every *.tex file. Not sure about toggling it on and off
    – cmhughes
    Mar 24, 2012 at 22:36
  • @cmhughes: yes that is right, it is in my .vimrc, updated. I am particularly encountering this problem when I try to chat/msg/etc about mathematics/related...and I do not have latex -file. Even though I open a new dummy.tex -file, the VLS -tings are not enabled -- mind-burning because it slows down my working a lot.
    – hhh
    Mar 25, 2012 at 0:31
  • Gathering here related problems here. Be alert that Vim.org's version and Sourceforge versions differ so be sure to get the newest version! Vim.org's has old versions.
    – hhh
    Mar 29, 2012 at 15:13
  • VLS is a ftplugin aka filetype-plugin so activated by filenames. Does this mean that it is impossible to do what I want?
    – hhh
    Mar 29, 2012 at 15:16

3 Answers 3

5

Maybe you did not really install Latex-Suite? I'm using Ubuntu and I noticed that it is not sufficient to install Latex-Suite using:

sudo apt-get install vim-latexsuite

For the actual installation you have to use Vim's addon manager:

vim-addons install latex-suite
3

This might solve your Problem:

http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-not-loaded-vim7

Look under the Question: "Why is vim-latex is no longer loaded when I open an empty .tex file after I upgraded to Vim 7?"

There is also this:

https://stackoverflow.com/questions/1970544/vim-how-to-manually-load-an-ftplugin-after-startup

Short answer: Both things you are trying to do should be possible.

1
  • I looked your first refered but that doesn't work. Provided that somedays ago that works for me.
    – alhelal
    Oct 15, 2017 at 12:58
2

Although gabkdlly's link answers your question, I'll post some explanation on why vim is behaving the way it behaves.

Normally, vim does filetype detection based on file extension. The .tex extension is shared by LaTeX, ConTeXt, plain TeX, and ePlain; so a simple filetype detection based on extension does not work. To circumvent this, vim checks for the file contents to see what type of a file it is: if the file contains a \begin{...} most likely it is a LaTeX file, if it contains \start... most likely it is a ConTeXt file, otherwise vim cannot be sure and it defaults to g:tex_flavor. The default value of g:tex_flavor is plain.

When you open a new .tex file, no keywords are found, so vim assumes that it is a plaintex file. To default to other formats, use one of the following:

let g:tex_flavor = "plain"
let g:tex_flavor = "context"
let g:tex_flavor = "latex"

Note that some files might be misrecognized by the simplistic algorithm used by vim. If you want to ensure that a file is detected correctly, set filetype in a vim modeline:

% vim: ft=plaintex " For plain 
% vim: ft=context  " For context
% vim: ft=tex      " For LaTeX

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .