Vim 无法识别来自 vim-latex 的某些命令
Vim not recognizing some commands from vim-latex
我通过 Vundle 安装了 vim-latex
,我正试图禁用它默认设置的一些烦人的映射。从 docs 我知道,例如,我可以使用以下命令取消映射 FEM
:
call IUNMAP('FEM','tex')
但是当我输入时出现错误 E117: Unknown function: IUNMAP
。
我通过在我的 vimrc
中包含 Plugin 'LaTeX-Suite-aka-Vim-LaTeX'
安装了带有 Vundle 的 vim-latex
我刚刚使用 PluginUpdate
命令更新了所有内容,它运行时没有错误,所以我应该有最新版本的软件包。
我是不是遗漏了什么?
函数 IMAP()
和 IUNMAP()
仅由 vim-latex 插件加载 在 你的 vim rc 被处理。因此,您需要从它们可用的上下文中执行它们。
此外,为了使取消映射成功,您需要在创建映射后实际执行它,并且通常在设置文件类型时创建映射。
documentation 提到这些最重要的规则应该在特定文件中完成:
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
.
文档提到您应该在使用的文件类型之后使用 ftplugin
中的文件。检查 :set ft?
以确认您确实是 tex
,在这种情况下,您可以使用 tex.vim
、tex_something.vim
(如建议的 tex_macros.vim
)或 tex/something.vim
(一个子目录。)
实际上,您遇到的问题与 您从哪里获得 vim-latex 有关。
有:
Plug 'LaTeX-Suite-aka-Vim-LaTeX'
您从 here 获取它,您会注意到它自 2010 年以来就没有更新过。查看该存储库中的 plugin/imaps.vim
文件,您会看到有一个定义对于函数 IMAP()
,但对于 IUNMAP()
,它可能是在存储库同步的最后日期之后引入的...
改为使用此来源:
Plug 'vim-latex/vim-latex'
将从 here 获取它,这是此插件的官方维护位置。
如果您查看该源代码树中的 plugin/imaps.vim
,您会注意到那里定义了 function! IUNMAP
。
更新到正确的插件位置应该可以为您解决这个问题(以及过去 10 年的许多修复!)
我通过 Vundle 安装了 vim-latex
,我正试图禁用它默认设置的一些烦人的映射。从 docs 我知道,例如,我可以使用以下命令取消映射 FEM
:
call IUNMAP('FEM','tex')
但是当我输入时出现错误 E117: Unknown function: IUNMAP
。
我通过在我的 vimrc
中包含 Plugin 'LaTeX-Suite-aka-Vim-LaTeX'
安装了带有 Vundle 的 vim-latex
我刚刚使用 PluginUpdate
命令更新了所有内容,它运行时没有错误,所以我应该有最新版本的软件包。
我是不是遗漏了什么?
函数 IMAP()
和 IUNMAP()
仅由 vim-latex 插件加载 在 你的 vim rc 被处理。因此,您需要从它们可用的上下文中执行它们。
此外,为了使取消映射成功,您需要在创建映射后实际执行它,并且通常在设置文件类型时创建映射。
documentation 提到这些最重要的规则应该在特定文件中完成:
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()
(orIUNMAP()
) 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
.
文档提到您应该在使用的文件类型之后使用 ftplugin
中的文件。检查 :set ft?
以确认您确实是 tex
,在这种情况下,您可以使用 tex.vim
、tex_something.vim
(如建议的 tex_macros.vim
)或 tex/something.vim
(一个子目录。)
实际上,您遇到的问题与 您从哪里获得 vim-latex 有关。
有:
Plug 'LaTeX-Suite-aka-Vim-LaTeX'
您从 here 获取它,您会注意到它自 2010 年以来就没有更新过。查看该存储库中的 plugin/imaps.vim
文件,您会看到有一个定义对于函数 IMAP()
,但对于 IUNMAP()
,它可能是在存储库同步的最后日期之后引入的...
改为使用此来源:
Plug 'vim-latex/vim-latex'
将从 here 获取它,这是此插件的官方维护位置。
如果您查看该源代码树中的 plugin/imaps.vim
,您会注意到那里定义了 function! IUNMAP
。
更新到正确的插件位置应该可以为您解决这个问题(以及过去 10 年的许多修复!)