简体   繁体   中英

How can I test my vim plugin?

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

About debugging: in order to see whether vim has loaded your plugin you can use :scriptnames and also breakadd file /path/to/your/plugin (or breakadd file *your_plugin_name.vim : I never used absolute paths so I do not know what breakadd will do in this case). Other questions:

  1. Described in :h initialization , precisely :h load-plugins .
  2. Vim does not need any files at all (except vim executable, used shared libraries, dynamic linker and the kernel of course).
  3. Follow installation instructions. Normally plugins are either extracted to ~/.vim or distributed as a singe file that should go to either ~/.vim/plugin (no s !), ~/.vim/colors , ~/.vim/ftplugin or such. I guess you should try to extract it to ~/.vim/plugin , but if archive contains some special directories like plugin/ , 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.

A few points.

  1. How does vim look for plugins? See :help startup so see where and when vim looks for files to load.
  2. Not really. Anything there is just personal customization. Vim will run fine without a .vim folder.
  3. That all depends on the plugin. It sounds to me like the VimClojure plugin may be a little misleading. Do you have a link to the source you are using?

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.

The VimClojure directory should either be extraction on top of your .vim folder, or in a bundle 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM