Ⅰ. 插件描述
Open files and web pages in associated programs from VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'xolox/open-associated-programs'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'xolox/open-associated-programs'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'xolox/open-associated-programs'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/xolox/vim-open-associated-programs
Ⅳ. 文档说明
# Open files and web pages in
associated programs from Vim
<span style="color: red">This Vim plug-in has been abandoned!</span> Most of its code has been absorbed into my miscellaneous scripts for Vim while the user interface part is still found in my vim-shell plug-in. I will no longer maintain the open.vim plug-in since I'm shifting focus to the miscellaneous scripts (because they're included in all of my Vim plug-ins and since I need the "open associated programs" functionality in several of my plug-ins, this makes most sense).
The open.vim plug-in knows how to open files, directories, URLs and e-mail addresses from inside Vim using the associated programs. It should work on Windows, Mac OS X and most Linux installations.
This plug-in doesn't define any mappings or commands so that other Vim plug-ins that need to launch a web browser can easily bundle the open.vim script. If you are looking for mappings / commands you can try my shell.vim plugin.
Installation
Unzip the most recent ZIP archive file inside your Vim profile directory (usually this is ~/.vim on UNIX and %USERPROFILE%\vimfiles on Windows), restart Vim and execute the command :helptags ~/.vim/doc (use :helptags ~\vimfiles\doc instead on Windows).
Note that on Windows a command prompt window pops up temporarily when either of the functions is called. If this bothers you then you can install my shell.vim plug-in which includes a DLL that works around this issue. Once you've installed both plug-ins it should work out of the box!
Usage
The xolox#open#file() function
This function takes a string argument containing a file or directory path and opens it just like double clicking the file or directory in your desktop environment would do. This means directories are opened in your file manager, image files are opened in an image viewer, ZIP files are opened in an archiving application, etc.
The xolox#open#url() function
This function takes a string argument containing a URL or e-mail address and opens it in your favorite or the best available web browser / e-mail client.
Contact
If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at http://peterodding.com/code/vim/open-associated-programs/> and
License
This software is licensed under the MIT license.
© 2010 Peter Odding <<peter@peterodding.com>>.