Ⅰ. 插件描述
Supports edit-run-edit cycle of your scriptingⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tomesoft/vim-literunner'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tomesoft/vim-literunner'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tomesoft/vim-literunner'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tomesoft/vim-literunner
Ⅳ. 文档说明
Title: liteRunner Vim plugin
Version: 0.5
Description: Supports Edit-Run-Edit cycle of your scripting
Author: Junichi OKADOME <tome@tomesoft.net>
Concept:
Edit,Run,Edit cycle is a very essential work for software development.
Shebang (#!...) in your editing file is an explicit directive to run them.
Why not use it? It's effective more than any other complex settings.
liteRunner plugin supports your Edit,Run,Edit cycle simply.
Installation:
a). with a Vimball "liteRunner.vba"
Download an archive from GitHub service;
https://github.com/tomesoft/vim-literunner/archives/master
You can choose either tar.gz or zip. Then extract it
to get contained Vimball.
$ vim liteRunner.vba
$ :so %
b). from GitHub with git
You can get a newer version of liteRunner plugin from;
git://github.com/tomesoft/vim-literunner.git
with git clone command
$ cd ~/.vim/bundle
$ git clone git://github.com/tomesoft/vim-literunner.git
If you have already introduced a plugin manager like "pathogen"
(https://github.com/Raimondi/vim-pathogen), you should follow that
plugin manager's way. Otherwise copy stuffs into ~/.vim directly
(on Windows, %USERPROFILE%\vimfiles) with contained Vimball.
Usage:
General mode <Leader>g, <Leader>G
- In editing your script, key-in <Leader>g (in default, <Leader> mapped
to backslash '') runs your script and the result is shown in output window. - If you need to pass some command line arguments when run it, key-in
<Leader>G, then cusor jumps into command line like;
:LRRunscript
input arguments (e.g. --help) and press return to run with the
arguments.
:LRRunscript --help
(is evaluated like as /usr/bin/env python myscript.py --help) - The specified arguments (in Step 2) are held (in buffer locally), and that
will be re-used on next run with <Leader>g until change them (using
<Leader>G) or finish editing.
Interactive mode <Leader>i, <Leader>I
If you already installed either
- ConqueTerm plugin (http://code.google.com/p/conque),
or - VimShell plugin (https://github.com/Shougo/vimshell/)
Interactive mode will be available to use. <Leader>i opens a terminal with
(hopefully) a REPL, and if existing a selection (in vim visual mode),
pass them to that interactive terminal.- ConqueTerm plugin (http://code.google.com/p/conque),
- To specify a REPL program, use <Leader>I. Command line will be shown as;
:LRRunRepl /usr/bin/env ruby
These are current setting (getting from shebang or something), and you can edit
the line like;
:LRRunRepl /usr/bin/env irb
then press return to run that command line for interactive mode.
Once it is specified, that value is held in variable b:liteRunner_REPL, and will
re-use until change it. - When an interactive (REPL running) terminal opened, select lines in editing buffer
via visual mode (v, V or Ctrl-V) then key-in <Leader>i, the selection will be
passed into the REPL (and it will be evaluated).
Customization:
- Key Mappings
You can change mappings, as you like;
:noremap <Leader>g :LRRunScriptWithHeldArguments<CR>
:noremap <Leader>G :<C->e("LRRunScript " . liteRunner#ExpandHeldScriptArguments())<CR>for Interactive mode (required ConqueTerm plugin)
:noremap <Leader>i :LRRunScriptInteractively<CR>
:nnoremap <Leader>I :<C->e("LRRunRepl " . liteRunner#ExpandRepl())<CR> Variables
Some variables are for customization, their prefix is g:liteRunner_XXX.- g:liteRunner_tries_to_use_shebang=1 (bool=0,1)
A flag means whether to use Shebang or not.
When set to 0, uses entry of g:liteRunner_ftyps_cmds_dict. - g:liteRunner_uses_quickfix_on_error=1 (bool=0,1)
A flag means whether to use quickfix or not on error - g:liteRunner_shows_quickfix_on_error=1 (bool=0,1)
A flag whether show quickfix (with :cope) or not. - g:liteRunner_checks_errors_always=0 (bool=0,1)
A flag wheter check errors (include exitcode==0) or not. - g:liteRunner_windowheight_default=5 (num)
Default (initial) height of the output window. A Number of output
lines are greater than the hight, the window height will be resized
up to g:liteRunner_windowheight_max - g:liteRunner_windowheight_max=10 (num)
Maximum height of the output window. A Number of output lines
are greater than the height, the window height will be resized
up to this value. - g:liteRunner_ftyps_cmds_dict={dict of defaults} (dict)
Dictionary, contains entries of filetype and respoinding commands.
That is used when not use Shebang (no Shebang in editing content or
g:liteRunner_tries_to_use_shebang set to 0).
Format of an entry;
'ruby' : ['/usr/bin/env ruby', '/usr/bin/env irb']
Key is a filetype, confirms with :echo &filetype.
Value is list of command lines, index=0 is for Generic mode,
and index=1 is for Interactive mode (optional).
It is better to use function liteRunner#UpdateFtypsCmdsEntry(),
to add/replace a part of entry (not whole dictionary). g:liteRunner_prognames_efms_dict={dict of defaults} (dict)
Dictionary, contains entries of program name and responding error formats.
When a program exited with error code (not 0), check to contain specific
errors in its output.
Format of an entry;
'python' : [\ '%A\ \ File\ \"%f\"\\,\ line\ %l', \ '%A\ \ File\ \"%f\"\\,\ line\ %l\\,\ %m', \ '%-C\ \ %p^', \ '%+C\ \ \ \ %s', \ '%+C%*[^\ :]%trror:\ %m', \]Key is a program name, e.g. python, ruby, gosh, ...
Value is a list of element of errorformat, eventually join with ','
then set to errorformat.
It is better to use function liteRunner#UpdatePrognamesEfmsEntry(),
to add/replace a part of entry (not whole dictionary).
For Interactive mode
- g:liteRunner_uses_ConqueTerm=0
- g:liteRunner_uses_VimShell=0
If you installed both ConqueTerm and VimShell, to specify
which should be used for interactive mode. By default,
tries to use in order as at first ConqueTerm, next VimShell. - g:liteRunner_ConqueTerm_command='ConqueTermSplit'
Command is to open an interactive terminal with ConqueTerm. - g:liteRunner_VimShell_command='VimShellInteractive'
Command is to open an interactive terminal with VimShell. - g:liteRunner_interactive_buffer_renew_everytime=0
A flag means whether renew terminal window everytime or not. - g:liteRunner_interactive_content_pass_mode=1
Mode value means how pass a content to terminal,
0=never pass, 1=selection only, 2=entire of content.
- g:liteRunner_tries_to_use_shebang=1 (bool=0,1)
There are some functions for customize, their prefix is liteRunner#XXX
- liteRunner#UpdateFtypsCmdsEntry(key, value)
see the variable g:liteRunner_ftyps_cmds_dict - liteRunner#UpdatePrognamesEfmsEntry(key, value)
see the variable g:liteRunner_prognames_efms_dict
- liteRunner#UpdateFtypsCmdsEntry(key, value)
ChangeLog:
2011-05-25 Junichi OKADOME <tome@tomesoft.net>
* NEW newly created and versioned v0.1
tested on MacOSX Vim7.32011-05-31 Junichi OKADOME <tome@tomesoft.net>
* NEW introduced Interactive mode (required ConqueTerm plugin)
* CHG supports autoloading
tested on MacOSX Vim7.3 and Windows7 gVim7.22011-06-17 Junichi OKADOME <tome@tomesoft.net>
* CHG Now a REPL can be specified with <Leader>I
(The old command which mapped <Leader>I has been obsolete)
Making Vimball:
To make a vimball "liteRunner.vba", run the following line in ':' mode
/^Files:/+1,/^--- end/-1MkVimball! liteRunner .
Files:
autoload/liteRunner.vim
plugin/liteRunner.vim
--- end of files ---
License:
The MIT License (MIT)
Copyright (c) 2011 Junichi OKADOME
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.