That's not the file. That's shadow.
Vim script Ruby


"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.


Assuming the product is, create first. (in Vim):

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

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

$a = 1;


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


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;
  • Use cpp command before committing Java files.

  • Markdown, Haml or something else to HTML


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


Tatsuhiro Ujihisa