Ⅰ. 插件描述
Launches current file with the associated program.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'caglartoklu/launchassociated-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'caglartoklu/launchassociated-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'caglartoklu/launchassociated-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/caglartoklu/launchassociated.vim
Ⅳ. 文档说明
# launchassociated.vim
Launches current file with the associated program.
For example, if you are editing an HTML file,
and type the command LaunchAssociated,
your default browser will open it.
It can be used on any file type, such as.xml, .html, .java or even .png,
anything that is associated with a program.
Vim.org page: http://www.vim.org/scripts/script.php?script_id=4755
Installation
For Vundle users:
Plugin 'caglartoklu/launchassociated.vim'
For all other users, simply drop the launchassociated.vim file to yourplugin directory.
Usage
LaunchAssociated
Launches currently opened file using the associated program.
If the buffer is empty, nothing will happen.
The current contents of the buffer will not be used,
only the file persisted on the file system will be used.
LaunchSpecial
This command can be used to define an alternative file association.
For example, markdown files could be associated with Vim in your operating system,
but using this command, it is possible to associate markdown files with another program, say, Firefox.
This association will be only valid in Vim, and the operating system will be unaffected.
SelectFile
Opens the file manager and selects the file in the buffer.
Currently, only Windows and Exlorer is supported for this command.
Configuration
Configuration for LaunchSpecial Command
You can associate a file type with a command.
You can use the placeholders in your command.
let g:launchassociated_special_launchers = {}
let g:launchassociated_special_launchers.markdown = '"C:\Program Files\Mozilla Firefox\firefox.exe" "{{bufferpath}}"'Placeholders
{{bufferpath}}: full path of the buffer
To Do
kde-openorgnome-openon Linux derivatives (and FreeBSD)
instead ofxdg-open
License
Licensed with 2-clause license ("Simplified BSD License" or "FreeBSD License").
See the LICENSE file.