shadow.vim


Ⅰ. 插件描述

That's not the file. That's shadow.

Ⅱ. 基本信息

创建日期:  2010-09-27
使用用户:  18
Github星:  40
插件作者:  ujihisa .

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/ujihisa/shadow.vim

Ⅳ. 文档说明

# shadow.vim

"Nobody knows the Java code you committed is originally written in Scheme."

Shadow.vim is a plugin to support you code with a wrapper transparently in a pluggable way.

Usage

Assuming the product is a.pl, create a.pl.shd first.

a.pl (in Vim):

## ruby -e 'puts $<.read.gsub(/$/, ";")'
$a = 1
print($a)

Open a.pl in Vim. The Vim actually shows the contents of a.pl.shd. When you save the file, the command in the first line without ## runs, then the actual a.pl will be the result.

a.pl (actually):

$a = 1;
print($a);

Install

Unarchive the zip file into a directory that is under &rtp of your Vim, including ~/.vim dir.

Commands

There's no commands or functions you have to use explicitly.

Use Case

Here there are three examples, but you can use more general purposes.

  • Commit JavaScript files which was written in CoffeeScript

    • before

      coffee -csb

      f = (x) -> x + 1
      print f 10

      vim: set ft=coffee :

    • after

      var f;
      f = function(x) {
      return x + 1;
      };
      print(f(10));

  • Use cpp command before committing Java files.
  • Markdown, Haml or something else to HTML

Limitation

The pair of a shadow file and the actual file is always 1-to-1 pair. That makes everything simple.

Author

Tatsuhiro Ujihisa

添加新评论