Ⅰ. 插件描述
Extend "gf" to open files with external programsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'dpwright/gf-ext'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'dpwright/gf-ext'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'dpwright/gf-ext'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/dpwright/vim-gf-ext
Ⅳ. 文档说明
#gf-ext.vim
Extend vim's gf shortcut to open files with external programs, based on the
file's extension. This is useful when you want to view or edit files which are
referenced in source code but aren't necessarily source text files themselves;
for example <img> tags in HTML, source asset files, and so on.
Installation
You can install gf-ext.vim in the usual way, by copying the contents of theplugin and doc directories into the equivalent directories inside .vim.
Alternatively, if you manage your plugins using pathogen.vim, you can
simply clone into the bundle directory:
cd ~/.vim/bundle
git clone git://github.com/dpwright/gf-ext
Or, using submodules:
cd ~/.vim
git submodule add git://github.com/dpwright/gf-ext bundle/gf-ext
Usage
gf-ext works by allowing you to define a handler for files matching a certain
- If no pattern matches, it falls back to the default
gfcommand.
To use the plugin, extract it to your vim plugins directory, and set up the
desired handlers using gf_ext#add_handler. For example, to open .jpg files
with firefox, and .avi files with vlc, you could use:
call gf_ext#add_handler('\.jpg$', "!firefox -new-window")
call gf_ext#add_handler('\.avi$', "!cvlc")Then just type gf over a file which matches one of the handlers as you usually
would!
For full documentation, install the plugin and run :help gf-ext from within
Vim.
Licence
gf-ext is distributed under the same terms as Vim itself. Run :license from
within Vim for more information.