## General question

How you can manually load a particular package from Vim-LaTeX in Vim and how it can be automated for every LaTeX file?

I am not interested in copying relevant parts from scripts of particular package to .vimrc as a workaround.

## Specific problem

This is just a supplementary part to explain how solving such problem may be useful.

### Short reminder

In The Not So Short Introduction to LaTeX 2ε you can read that:

A tilde ‘~’ character generates a space that cannot be enlarged and additionally prohibits a line break.

In Polish we should not leave short conjunctions at the end of line. ~ is helpful here, but writing it after conjunctions is cumbersome (and spoils the typing flow, and you can just forget about it sometimes).

Vim-LaTeX (vim-latexsuite package in debian; I am using version 20100129-2 in squeeze, just in case) provides per package additional customization. For Polish texts we use package polski in LaTeX and its Vim-LaTeX counterpart modifies space, so it automatically replaces space with tilde after short words.

### Issue

For larger LaTeX documents splitting text between many files is a common practice. And here comes the problem with package detection in Vim-LaTeX. If I open the main .tex file (i.e. the one including other .tex files), where \usepackage{polski} is present, then space substitution works fine. It's not the file where you are writing much, thus it's not really useful here. But if I open any other .tex file (which is included by the main .tex file), which obviously does not have preamble (thereby there is no \usepackage{polski} in it), package detection fails, therefore space substitution is not working here.

### Partial solution

I have figured out some partial flawed solution.

au FileType tex call Tex_pack_one('polski')

It's bad because it doesn't work if you open another .tex file in new window (via :sp or :vs for instance), even if this file have \usepackage{polski} (so it's a regression).

Simple testing. Go to insert mode and write i i i. You should see i~i~i. Open full LaTeX document (with preamble and \usepackage{polski}) in new window. Repeat the test there. Open third LaTeX document (w/o preamble) and repeat the test again.

### Quote from my mail on vim-latex mailing list about using latex-master-file

Sent: Sun, May 22, 2011 at 11:23 (GMT+02:00)

I removed mentioned before au FileType tex call Tex_pack_one('polski') line from .vim.rc to avoid any clashes and added empty main.tex.latexmain file. From polski package PoV situation is the same as with my partial solution. Only first opened file works properly, another windows with .tex files do not.

I am starting to think that problem is in how package loading works internally in vim-latex (as oriented mostly for rarely used menus [correct me if I'm wrong], that should be extended only once) preventing executing packages' scripts more than once. Also polski package may have some bugs. I know Vim and can conveniently use its editing powers, but I haven't learned Vim scripting language yet (writing simple .vimrc doesn't require any special knowledge), thus I cannot judge here and need help of advanced Vim users/programmers.

-
I've started a thread at vim-latex mailing list. –  przemoc May 22 '11 at 9:31