vim-runners


Ⅰ. 插件描述

A vim plugin to compile and/or run arbitrary filetyped buffers

Ⅱ. 基本信息

创建日期:  2014-01-07
使用用户:  1
Github星:  3
插件作者:  Jeff Fowler

Ⅲ. 安装方法

使用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.rb

Currently 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

  1. If no makefile is found, Run will try to compile the current
  2. 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.

添加新评论