Thread: [Vim-latex-devel] Seting TeX flavor properly in Vim7
Brought to you by:
srinathava,
tmaas
From: Ted P. <te...@te...> - 2008-08-04 12:14:24
|
In the recent patches that were applied to Vim-LaTeX, was the line: let g:tex_flavor='latex' added somewhere? Without it, Vim7's filetype plugin fails to load Vim-LaTeX. Something changed between Vim6 and Vim7 that made latex *not* the default, which seems strange. -- Ted Pavlic <te...@te...> |
From: Till M. <ope...@ti...> - 2008-08-05 18:48:34
|
On Mon August 4 2008, Ted Pavlic wrote: > In the recent patches that were applied to Vim-LaTeX, was the line: > > let g:tex_flavor='latex' > > added somewhere? Without it, Vim7's filetype plugin fails to load > Vim-LaTeX. Something changed between Vim6 and Vim7 that made latex *not* > the default, which seems strange. According to svn in the file trunk/vimfiles/ftplugin/latex-suite/texrc, there was the following line since 2002-04-30: TexLet g:Tex_Flavor = 'latex' This is the comment about it: " NOTE: The values of g:Tex_Flavor and g:Tex_CompilerFlags are provided as a " way to make compiler/tex.vim standalone. i.e independent of the rest " of latex-suite. These variables are NOT used if you have already " defined g:Tex_CompileRule_dvi above. " " specifies the current latex flavor. Hth, Till |
From: Ted P. <te...@te...> - 2008-08-05 19:15:30
|
Till -- Thanks for looking that up, but I'm not sure how it applies. As of Vim7, if you don't have: let g:tex_flavor='latex' then the default filetype behavior to a ".tex" file is to treat it as plaintex. In that case, Vim-LaTeX is not invoked at all and thus the texrc doesn't get run. It looks like some native Vim compiler support was added in Vim7. That support wasn't there in 6, and so Vim-LaTeX would get started automatically. Now, in a vanilla Vim7 installation with no explicit g:tex_flavor set, Vim-LaTeX is ignored. I frequently respond to messages in other groups where people complain about Vim-LaTeX not getting loaded, and that's just because they upgraded to Vim7 and didn't know to add the flavor line to their vimrc. After that, everything is fine. For some reason, I never thought to post here and see if there was a way to modify the Vim-LaTeX distro so that setting g:tex_flavor wasn't necessary. <?> --Ted Till Maas wrote: > On Mon August 4 2008, Ted Pavlic wrote: >> In the recent patches that were applied to Vim-LaTeX, was the line: >> >> let g:tex_flavor='latex' >> >> added somewhere? Without it, Vim7's filetype plugin fails to load >> Vim-LaTeX. Something changed between Vim6 and Vim7 that made latex *not* >> the default, which seems strange. > > According to svn in the file trunk/vimfiles/ftplugin/latex-suite/texrc, there > was the following line since 2002-04-30: > TexLet g:Tex_Flavor = 'latex' > > This is the comment about it: > " NOTE: The values of g:Tex_Flavor and g:Tex_CompilerFlags are provided as a > " way to make compiler/tex.vim standalone. i.e independent of the rest > " of latex-suite. These variables are NOT used if you have already > " defined g:Tex_CompileRule_dvi above. > " > " specifies the current latex flavor. > > Hth, > Till > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Vim-latex-devel mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel -- Ted Pavlic <te...@te...> |
From: Till M. <ope...@ti...> - 2008-08-05 20:29:40
|
On Tue August 5 2008, Ted Pavlic wrote: > Till -- > > Thanks for looking that up, but I'm not sure how it applies. > > As of Vim7, if you don't have: > > let g:tex_flavor='latex' > > then the default filetype behavior to a ".tex" file is to treat it as > plaintex. In that case, Vim-LaTeX is not invoked at all and thus the > texrc doesn't get run. I have vim 7.1.245 from Fedora, which ships some tex.vim files. Nevertheless vim-latex is still run, e.g. the folding is still done by vim-latex and \ll runs latex. Maybe some features are not working, is there some minimal tex file where something does not work for you without setting tex_flavor? Or where may tex_flaveor be already set, it is not in my .vimrc or in /etc/vimrc. > It looks like some native Vim compiler support was added in Vim7. That > support wasn't there in 6, and so Vim-LaTeX would get started > automatically. Now, in a vanilla Vim7 installation with no explicit > g:tex_flavor set, Vim-LaTeX is ignored. Here vim provides these files: /usr/share/vim/vim71/compiler/tex.vim /usr/share/vim/vim71/ftplugin/initex.vim /usr/share/vim/vim71/ftplugin/plaintex.vim /usr/share/vim/vim71/ftplugin/tex.vim /usr/share/vim/vim71/syntax/initex.vim /usr/share/vim/vim71/syntax/plaintex.vim /usr/share/vim/vim71/syntax/tex.vim I do not know how they interfer with vim-latex, though. Regards, Till |
From: Eyolf Ø. <ey...@oe...> - 2008-08-05 20:38:05
|
On 05.08.2008 (22:29), Till Maas wrote: > > I have vim 7.1.245 from Fedora, which ships some tex.vim files. Nevertheless > vim-latex is still run, e.g. the folding is still done by vim-latex and \ll > runs latex. Maybe some features are not working, is there some minimal tex > file where something does not work for you without setting tex_flavor? Or > where may tex_flaveor be already set, it is not in my .vimrc or > in /etc/vimrc. FWIW, I seem to remember that files without a preamble (i.e. when I use latexprojects), would get a ft=plaintex if the tex_flavor wasn't set. Eyolf -- Han Solo: Oh! I thought they smelled bad on the *outside*! |
From: Ted P. <te...@te...> - 2008-08-05 20:44:50
|
> I have vim 7.1.245 from Fedora, which ships some tex.vim files. Nevertheless > vim-latex is still run, e.g. the folding is still done by vim-latex and \ll > runs latex. Maybe some features are not working, is there some minimal tex > file where something does not work for you without setting tex_flavor? Or > where may tex_flaveor be already set, it is not in my .vimrc or > in /etc/vimrc. Try opening an empty file (e.g., "blah.tex") with no preamble. On my system, if Vim can't find a "\documentclass{article}", it defaults to plaintex. As a result, none of the Vim-LaTeX menus load in gvim (or mvim in my case) and none of the folding/shortcuts/etc. work. --Ted -- Ted Pavlic <te...@te...> |
From: Till M. <ope...@ti...> - 2008-08-05 21:13:27
|
On Tue August 5 2008, Ted Pavlic wrote: > > I have vim 7.1.245 from Fedora, which ships some tex.vim files. > > Nevertheless vim-latex is still run, e.g. the folding is still done by > > vim-latex and \ll runs latex. Maybe some features are not working, is > > there some minimal tex file where something does not work for you without > > setting tex_flavor? Or where may tex_flaveor be already set, it is not in > > my .vimrc or > > in /etc/vimrc. > > Try opening an empty file (e.g., "blah.tex") with no preamble. > > On my system, if Vim can't find a "\documentclass{article}", it defaults > to plaintex. As a result, none of the Vim-LaTeX menus load in gvim (or > mvim in my case) and none of the folding/shortcuts/etc. work. Looking at the comments in /usr/share/vim/vim71/filetype.vim it may be a bug im vim, because they default to plain instead of latex, when they do not find any latex commands, but the comment says, they would default to latex. Therefore this should be discussed with upstream first. Maybe they can be persuaded to use latex as default for empty files that have a .tex suffix. Btw. it is possible to add a "plaintex_latexSuite.vim -> tex_latexSuite.vim" symlink in the ftplugin dir of vim-latex, then vim-latex will also open for empty .tex files. But I am not sure, whether or not this is a good solution. Regards, Till |
From: Ted P. <te...@te...> - 2008-08-07 13:16:48
|
> Looking at the comments in /usr/share/vim/vim71/filetype.vim it may be a bug > im vim, because they default to plain instead of latex, when they do not find Excellent point. I posted a message (referencing your message here) to the vim_use list. In retrospect, perhaps the vim-dev list would have been better. > Btw. it is possible to add a "plaintex_latexSuite.vim -> tex_latexSuite.vim" > symlink in the ftplugin dir of vim-latex, then vim-latex will also open for > empty .tex files. But I am not sure, whether or not this is a good solution. Good point. Though, looking at those comments and the code, setting g:tex_flavor seems like the preferred/sanctioned solution. --Ted -- Ted Pavlic <te...@te...> |
From: Ted P. <te...@te...> - 2008-08-07 13:16:59
|
> Looking at the comments in /usr/share/vim/vim71/filetype.vim it may be a bug > im vim, because they default to plain instead of latex, when they do not find > any latex commands, but the comment says, they would default to latex. > Therefore this should be discussed with upstream first. Maybe they can be > persuaded to use latex as default for empty files that have a .tex suffix. From a message in vim_dev: ===== In :h filetype, Vim 7.2c says that "If no keywords are found, it defaults to plaintex", which is the current behavior when g:tex_flavor is not defined. Maybe the comment is outdated. ===== So I wonder if something special should be added to the Vim-LaTeX documentation to instruct users to change their tex_flavor if they want empty .tex files to load Vim-LaTeX... -- Ted Pavlic <te...@te...> |
From: Till M. <ope...@ti...> - 2008-08-07 13:58:21
|
On Thu August 7 2008, Ted Pavlic wrote: > So I wonder if something special should be added to the Vim-LaTeX > documentation to instruct users to change their tex_flavor if they want > empty .tex files to load Vim-LaTeX... I added some documentation about it here: http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-not-loaded-vim7 http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html Regards, Till |
From: Ted P. <te...@te...> - 2008-08-07 15:55:10
|
FYI, James Vega posted this in the vim-dev list: ===== Before Vim7 was released, Benji Fisher (the tex ftplugin maintainer) brought up these changes for discussion[0]. There was also a discussion started by Stefano Zacchiroli[1] a few months later wondering whether tex should be the default. [0] - http://thread.gmane.org/gmane.editors.vim.devel/11826 [1] - http://thread.gmane.org/gmane.linux.debian.packages.vim.devel/2915/focus=14409 ===== That explains some things. It's nice to see that people debated... I guess... --Ted Till Maas wrote: > On Thu August 7 2008, Ted Pavlic wrote: > >> So I wonder if something special should be added to the Vim-LaTeX >> documentation to instruct users to change their tex_flavor if they >> want empty .tex files to load Vim-LaTeX... > > I added some documentation about it here: > http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-not-loaded-vim7 > > http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html > > > Regards, Till > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge Build the coolest Linux based applications with Moblin SDK > & win great prizes Grand prize is a trip for two to an Open Source > event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > > _______________________________________________ Vim-latex-devel > mailing list Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel -- Ted Pavlic <te...@te...> |
From: Ted P. <te...@te...> - 2008-08-07 16:18:28
|
Evidently, adding: %&latex to the top of any .tex file will set the proper filetype. So if you don't want to force the tex_flavor, add that comment to the top of your LaTeX sources. --Ted Ted Pavlic wrote: > In the recent patches that were applied to Vim-LaTeX, was the line: > > let g:tex_flavor='latex' > > added somewhere? Without it, Vim7's filetype plugin fails to load > Vim-LaTeX. Something changed between Vim6 and Vim7 that made latex *not* > the default, which seems strange. > > -- Ted Pavlic <te...@te...> |
From: Till M. <ope...@ti...> - 2008-08-07 16:26:37
|
On Thu August 7 2008, Ted Pavlic wrote: > Evidently, adding: > > %&latex > > to the top of any .tex file will set the proper filetype. > > So if you don't want to force the tex_flavor, add that comment to the > top of your LaTeX sources. You can also add this to the top of the file (or at the end) to probably get the same (the filetype will be set to tex): % vim: filetype=tex Regards, Till |
From: Ted P. <te...@te...> - 2008-08-07 16:33:46
|
>> Evidently, adding: >> >> %&latex >> >> to the top of any .tex file will set the proper filetype. > > You can also add this to the top of the file (or at the end) to probably get > the same (the filetype will be set to tex): > > % vim: filetype=tex Very cool. That works well. Thanks -- Ted -- Ted Pavlic <te...@te...> |
From: Ted P. <te...@te...> - 2008-08-07 16:44:05
|
I've tried to document all of these solutions in: http://phaseportrait.blogspot.com/2008/03/vim-latex-vim-70-and-filetype-plugin.html --Ted Ted Pavlic wrote: >>> Evidently, adding: >>> >>> %&latex >>> >>> to the top of any .tex file will set the proper filetype. >> You can also add this to the top of the file (or at the end) to probably get >> the same (the filetype will be set to tex): >> >> % vim: filetype=tex > > Very cool. That works well. > > Thanks -- > Ted > > -- Ted Pavlic <te...@te...> |
From: Till M. <ope...@ti...> - 2008-08-07 16:51:14
|
On Thu August 7 2008, Ted Pavlic wrote: > I've tried to document all of these solutions in: > > http://phaseportrait.blogspot.com/2008/03/vim-latex-vim-70-and-filetype-plu >gin.html Btw. you can abbreviate filetype as ft. Regards, Till |
From: Ted P. <te...@te...> - 2008-08-07 17:05:43
|
> Btw. you can abbreviate filetype as ft. Yep, but because I was taking the time to document it, I wanted the solution to be self-explanatory. That being said, if people like the idea of manually setting their filetype over and over again... maybe it's better to list the abbreviation. I've now noted both abbreviations. --Ted -- Ted Pavlic <te...@te...> |