Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim not recognizing some commands from vim-latex

I have vim-latex installed via Vundle and I'm trying to disable some annoying mapping that it sets up by default. From the docs I know that, for example, I can use the following command to unmap FEM:

call IUNMAP('FEM','tex')

But when I type that I get the error E117: Unknown function: IUNMAP.

I have installed vim-latex with Vundle by including Plugin 'LaTeX-Suite-aka-Vim-LaTeX' in my vimrc and I have just used the PluginUpdate command to update everything, which runs with no error, so I should have the latest version of the package.

Am I missing something here?

like image 207
TomCho Avatar asked Aug 03 '26 02:08

TomCho


1 Answers

The functions IMAP() and IUNMAP() are loaded by the vim-latex plug-in only after your vimrc is processed. So you need to execute them from a context where they're available.

Furthermore, in order to have your unmapping succeed, you need to actually execute it after the mapping was created, and mappings are typically created when the filetype is set.

The documentation mentions that these overriding rules should be done in specific files:

An important thing to note is that if you wish to over-ride macros created by Latex-Suite rather than merely create new macros, you should place the IMAP() (or IUNMAP()) calls in a script which gets sourced after the files in Latex-Suite.

A good place typically is as a file-type plugin file in the ~/.vim/after/ftplugin/ directory. [...]

For example, to delete a mapping, you can use

call IUNMAP('FEM', 'tex')

in ~/.vim/after/ftplugin/tex_macros.vim.

The documentation mentions that you should use a file in ftplugin after the filetype you use. Check :set ft? to confirm yours is indeed tex, in which case you can use tex.vim, tex_something.vim (like the suggested tex_macros.vim) or tex/something.vim (a subdirectory.)

like image 112
filbranden Avatar answered Aug 05 '26 20:08

filbranden



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!