Vim Tips Wiki
Tip 816 Printable Monobook Previous Next

created November 5, 2004 · complexity basic · author zzapper · version 5.7

Perl has its JAPH Just Another Perl Hacker (a short script that produces the output 'Just another Perl hacker' (Google for it)). I thought one day I'd try to something similar with Vim, the trick being to make it as obscure as possible:

vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"

Here are some others, from various sources.

:s(.*(rekcaH iV rehtonA tsuJ(|t.|s).$)&&)|-s'.'s,\\(.\\)\\(.\\)\\(\\2.*\\),\\2\\3\\1,|'g|s=[^|]*|$=s,.,,=|d a|@a
gvim -c "exec \"normal itYNQ#v'Z#ABG#GUR#BAYL#BAR\"|%s/#/ /g|normal ggVGg?ggVG~"

So what's the point:

  1. It attracts a few more people to Vim (I use it as a signature).
  2. It sharpens your Vim skills.
  3. It's fun.

This "tip" shows that you can do some pretty complex stuff with the Vim -c command.

vim -c "cmd1|cmd2|cmd3"
# Example: print paste contents to default printer
gvim -c 's/^/\=@*/|hardcopy!|q!'