如何测试我的 vim 插件?
大家好:我最近(不小心)从 mac os x(主目录)中的 .vim 文件夹中删除了所有文件夹/文件。
我正在尝试添加 Clojure Vim 插件 (VimClojure) - 它只是一个您应该“放入 .vim/plugins”的文件夹。
我已经添加了它,但是当我启动 vim 时,我没有看到语法突出显示有任何变化。我不确定 vim 是否“看到”该插件。
我在 OS X 上。
关于如何调试插件有什么想法吗?特别是
1) VIM 如何寻找插件?
2) $HOME/.vim/ 中是否有需要的文件?
3) 安装标准 vim 插件时,只需将解压的新插件文件转储到 $HOME/.vim/plugins 中就足够了吗?
谢谢
Hi guys : I recently (accidentally) removed all folders/files from my .vim folder in mac os x (home directory).
I am trying to add in the Clojure Vim plugin (VimClojure) - its simply a folder which you are supposed to "drop into .vim/plugins".
I have added it, but I don't see any changes to the syntax highlighting when I launch vim. I'm not sure wether vim "sees" the plugin or not.
I'm on OS X .
Any ideas on how to debug the plugin ? In particular
1) How does VIM look for plugins ?
2) Are there files which need to be in $HOME/.vim/ ?
3) Is it sufficient to simply dump the unzip a new plugin file into $HOME/.vim/plugins when installing a standard vim plugin ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
关于调试:为了查看 vim 是否已加载您的插件,您可以使用
:scriptnames
以及breakadd file /path/to/your/plugin
(或breakadd file *your_plugin_name.vim
:我从未使用过绝对路径,所以我不知道在这种情况下breakadd会做什么)。其他问题::h初始化
中描述,确切地说是:h load-plugins
。~/.vim
,要么作为单个文件分发到~/.vim/plugin
(没有s
>!)、~/.vim/colors
、~/.vim/ftplugin
等。我想你应该尝试将其解压到~/.vim/plugin
中,但是如果存档包含一些特殊目录,例如plugin/
、ftplugin/
,colors/
,after/
(参见/usr/share/vim/vim73
获取列表)它可能应该转到 <代码>~/.vim。如果插件发布在 vim 上,还可以考虑使用 vim-addon-manager .org VAM 很可能能够安装它。About debugging: in order to see whether vim has loaded your plugin you can use
:scriptnames
and alsobreakadd file /path/to/your/plugin
(orbreakadd file *your_plugin_name.vim
: I never used absolute paths so I do not know what breakadd will do in this case). Other questions::h initialization
, precisely:h load-plugins
.~/.vim
or distributed as a singe file that should go to either~/.vim/plugin
(nos
!),~/.vim/colors
,~/.vim/ftplugin
or such. I guess you should try to extract it to~/.vim/plugin
, but if archive contains some special directories likeplugin/
,ftplugin/
,colors/
,after/
(see/usr/share/vim/vim73
for a list) it is likely that it should go to~/.vim
. Also consider using vim-addon-manager, if plugin was posted on vim.org VAM is likely to be able to install it.几点。
:helpstartup
了解 vim 何时何地查找要加载的文件。无论如何,在尝试调试脚本时我总是采取的第一步是检查
:scriptnames
的输出。该命令将显示 vim 为当前会话加载了哪些脚本。如果您没有看到 VimClojure 附带的任何文件,则您可能在安装过程中犯了错误。另一个提示是,您确实应该考虑使用插件管理器,例如 vundle 或 vim-addon-manager,或者至少是
runtimepath
管理器 病原体。这似乎是当今 vim 配置的未来方式,它使安装和管理插件变得更加容易。它们还有助于保持 .vim 文件夹干净且井井有条。A few points.
:help startup
so see where and when vim looks for files to load.In any case, the first step I always take when attempting to debug a script is check the output of
:scriptnames
. This command will show you what scripts vim has loaded for the current session. If you see none of the files shipped with VimClojure, you probably made a mistake during the installation.Another tip is that you really should look in to using a plugin manager such as vundle or vim-addon-manager, or at least the
runtimepath
manager pathogen. This seems to be the way of the future for vim configuration these days and it makes installing and managing plugins much easier. They also help to keep your .vim folder clean and organized.VimClojure 目录应该提取在
.vim
文件夹的顶部,或者如果您使用 病原体(你应该这么做!)。如果你是从头开始,请考虑从 vimclojure-easy 开始(不要自吹自擂)这是 VimClojure 的基本完整安装,附有说明。The VimClojure directory should either be extraction on top of your
.vim
folder, or in abundle
folder if your using something like pathogen (which you should!). If you're starting from scratch, consider starting with vimclojure-easy (not to toot my own horn) which is a basic, full install of VimClojure with instructions.