Ⅰ. 插件描述
A vim plugin to compile and/or run arbitrary filetyped buffersⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'urthbound/vim-runners-is-written-on'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'urthbound/vim-runners-is-written-on'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'urthbound/vim-runners-is-written-on'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/urthbound/vim-runners
Ⅳ. 文档说明
vim-runners
This is a very simple plugin that dynamically knows how to run a bunch of
common filetypes through their associated interpreter.
The Run command will save the buffer to disk, then execute what is usually
the equivalent of
:!<languagename> <filename>like
:!ruby ./a_script_that_does_something_that_is_in_this_buffer_rn.rbCurrently supports:
- Ruby
- Python
- PHP
- JavaScript (via node)
- Bash
- a few more!
Adding rules
Adding a rule is easy. Just duplicate an elsif block:
elseif (&ft=='python')
command! Run w % | !python %And change stuff around so it does what you want
elseif (&ft=='LOLCODE')
command! Run w % | !lci %C
-
If a makefile named "makefile" exists in the working directory, Run will
attempt to execute a rule called 'run', essentially delegating its behavior to
the makefile. The run rule would likely rely on the main executable rule, and
might or might not clean up after itself, but you could do whatever you want in
- If no makefile is found,
Runwill try to compile the current - on its own into
./vrun.out, execute it, and clean up after
itself by deleting it. Useful for quickly trying out something in a lone main().
On entry into a buffer, Run is redefined to refer to the appropriate command
for that filetype. If no mapping is found, Run will echo 'Interpreter unavailable'
I mapped Run to <LEADER>g. Looks like this:
nnoremap <LEADER>g :Run<CR>Installation
I like vim-plug.
License
Copyright (c) Jeff Fowler. Distributed under the same terms as Vim itself a la Tim Pope.
See :help license.