easy-execute : Execute files easy in unix
| script karma
Downloaded by 196
Comments, bugs, improvements
script versions (upload new version)
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.
Execute the file related to the current buffer:
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.
|Installation: Copy easy-execute.vim to your plugin directory.|
Click on the package to download.
ip used for rating: 188.8.131.52