easy-execute


Ⅰ. 插件描述

Execute files easy in unix

Ⅱ. 基本信息

创建日期:  2016-05-24
使用用户:  0
Github星:  0
插件作者:  

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/easy-execute'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/easy-execute'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/easy-execute'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone 

Ⅳ. 文档说明

Overview:

Often, there is a single action that is performed often for a given filetype.
For example, for source code file unit tests are performed if present.

Usage:

Execute the file related to the current buffer:
call g:Exec_file()

An example of .vimrc:
nnore <C-E> :w<cr>:call Exec_file()<cr>

g:easy_execution_pattern associates the file path to pattern handlers (funcref).
See the examples in the source code. Notice that a handler should return 1 if
the file was executed and 0 otherwise (0 means the filetype was not recognized).  
This allows setting handlers for uncertain cases such as shell scripts (which may
or may not have .sh in the end). The handler takes the path of the file and the shell
escaped name as a parameter.

As the working directory is also used to determine the file type (e.g. for
Perl modules, we check if Makefile.PL is found). Consequently, changing the
working directory using e.g. vim-rooter prior to calling g:Exec_file is
advisable (by adding commands to the key map).

The utility function g:Easy_system may be used for forking processes.
Usually the handlers should return 0 in the case of failed execution as
the filetype was recognized. g:Easy_system does the error handling by
checking the error code and showing the process output to the user in a
buffer associated with a temporary file.

添加新评论