在 vim 中保存 :map 的输出 [英] Saving output of :map in vim
问题描述
Q1:有没有办法保存命令的输出
Q1: Is there a way of saving the output of the command
:map
文件?
Q2:在一个相关问题中,我的 vimrc 文件中有以下映射:
Q2: In a related question, I have the following map in my vimrc file:
map <f1> :wa<cr>
当我加载一个 latex 文件时(我安装了 vim-latex 插件),F1 键现在调用帮助.
有没有一种方法可以更改此设置而无需再次手动输入地图?
When I load a latex file (I have the vim-latex plugin installed), the
F1 key now invokes help.
Is there a way of changing this without manually having to type the map again?
推荐答案
A1: 重定向/保存 :map
的输出:
A1: To redirect/save the output of :map
:
:redir >> ~/mymaps.txt
:map
:redir END
A2:
正如 kemp 所说,您可以使用 verbose
找到它并修改插件文件.
As kemp says, you can find it using verbose
and modify the plugin file.
或者你可以在你的插件目录中创建一个最后运行的vim文件,例如,~/.vim/plugin/zzzmyremaps.vim
(通过运行脚本名称检查)
Or you can create a vim file in your plugins directory that runs last, e.g., ~/.vim/plugin/zzzmyremaps.vim
(check by running scriptnames)
rampion 在评论中是正确的.因为这是一个文件类型问题,这应该在目录 ~/.vim/after/plugin/latex.vim
中处理,因为有问题的 latex.vim 文件不是在启动时加载,而是在缓冲区输入.
rampion is correct in the comments. Because this is a filetype issue, this should be handled in the after directory ~/.vim/after/plugin/latex.vim
as the offending latex.vim file is not being loaded on startup but on a buffer enter.
注意 .vimrc
是最先获取的,所以插件有覆盖它们的习惯.:scriptnames
将显示顺序.
Note .vimrc
gets sourced first so plugins have a habit of overwriting them. :scriptnames
will show the order.
这篇关于在 vim 中保存 :map 的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!