Vim Tips Wiki
m (JAVH: Just another VIM Hacker moved to JAVH - Just another Vim Hacker: Page moved by JohnBot to improve title)
(Change to TipImported template + severe manual clean)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=816
 
|id=816
  +
|previous=814
|title=JAVH: Just another VIM Hacker
 
  +
|next=817
|created=November 5, 2004 16:38
+
|created=November 5, 2004
 
|complexity=basic
 
|complexity=basic
 
|author=zzapper
 
|author=zzapper
 
|version=5.7
 
|version=5.7
 
|rating=24/10
 
|rating=24/10
|text=
 
Perl has it's JAPH Just Another Perl Hacker (a short script that produces the output 'Just another Perl hacker' (Just 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?"
 
 
 
 
Somebody (sorry I forget who, possibly Peppe) did this one
 
 
 
 
:s(.*(rekcaH iV rehtonA tsuJ(|t.|s).$)&&)|-s'.'s,\\(.\\)\\(.\\)\\(\\2.*\\),\\2\\3\\1,|'g|s=[^|]*|$=s,.,,=|d a|@a
 
 
 
 
Another voyager in cyberspace created the following
 
 
 
 
gvim -c "exec \"normal itYNQ#v'Z#ABG#GUR#BAYL#BAR\"|%s/#/ /g|normal ggVGg?ggVG~"
 
 
 
 
So what's the point:-
 
 
1) Well it attracts a few more people to VIM (I use it as a signature)
 
 
2) It sharpens your Vim skills,(they can never be sharp enough)
 
 
3) It's fun
 
 
 
 
So over to you! can you do any better!
 
 
}}
 
}}
 
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:
   
  +
<pre>
== Comments ==
 
 
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
What does the script do?
 
  +
</pre>
   
  +
Here are some others, from various sources.
What is it good for?
 
   
  +
<pre>
Please make your message more exoteric.
 
 
:s(.*(rekcaH iV rehtonA tsuJ(|t.|s).$)&amp;&amp;)|-s'.'s,\\(.\\)\\(.\\)\\(\\2.*\\),\\2\\3\\1,|'g|s=[^|]*|$=s,.,,=|d a|@a
  +
</pre>
   
  +
<pre>
'''Anonymous'''
 
 
gvim -c "exec \"normal itYNQ#v'Z#ABG#GUR#BAYL#BAR\"|%s/#/ /g|normal ggVGg?ggVG~"
, November 8, 2004 6:08
 
  +
</pre>
----
 
`Please make your message more exoteric.'
 
   
That's the spirit!
+
So what's the point:
 
#It attracts a few more people to Vim (I use it as a signature).
 
#It sharpens your Vim skills.
 
#It's fun.
   
 
This "tip" shows that you can do some pretty complex stuff with the Vim -c command.
$ vim -u NONE +let\ --AT--o=ƆfJX\ ~PFJX0\$2hP0--AT--Oy00'\|0put='csatH\ \ AmnioVt\ hreUeJKr'\|norm!+d_--AT--O
 
 
The above should all be on one line. If it wraps after a
 
backslash, it's because there was a space there.
 
 
ad_scriven--AT--postmaster.co.uk
 
, November 8, 2004 7:26
 
----
 
Blecch. It didn't like backslashes followed single-quotes.
 
The first characters after --AT--o= should be
 
a backslash followed by a single-quote. All the other
 
single-quotes should be preceded by a backslash.
 
 
ad_scriven--AT--postmaster.co.uk
 
, November 8, 2004 7:36
 
----
 
Blecch. It didn't like backslashes followed single-quotes.
 
The first characters after --AT--o= should be a backslash
 
followed by a single-quote, then 0fJ etc. All the other
 
single-quotes should be preceded by a backslash.
 
 
ad_scriven--AT--postmaster.co.uk
 
, November 8, 2004 7:37
 
----
 
Nice, useful to show off to vim hackers,
 
but a newcomer will be turned off by Vim by such complexity.
 
 
Perci Merci
 
, November 8, 2004 17:39
 
----
 
I was turned on to vim by such complexity (flexibility).
 
 
ad_scriven--AT--postmaster.co.uk
 
, November 9, 2004 4:43
 
----
 
I like this idea and thought I'd highlight the line to make this even cooler.
 
So I tried something like this
 
$vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?|exe 'mat Error /\%'.line(".").'l.*'"
 
but didn't work.
 
 
When I do this first,
 
$vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
 
and then execute
 
:exe 'mat Error /\%'.line(".").'l.*'
 
inside vim, it highlights as I expected.
 
 
Can anyone tell me why?
 
 
 
'''Anonymous'''
 
, November 9, 2004 6:17
 
----
 
This "tip" hightlights that you can do some pretty complex stuff with the vim -c command
 
vim -c "cmd1|cmd2|cmd3"
 
eg
 
&#35; print paste contents to default printer
 
gvim -c 's/^/\=--AT--*/|hardcopy!|q!'
 
   
  +
<pre>
But here as a bit of light-relief Vim's Easter Eggs
 
 
vim -c "cmd1|cmd2|cmd3"
 
# Example: print paste contents to default printer
 
gvim -c 's/^/\=@*/|hardcopy!|q!'
  +
</pre>
   
 
==Comments==
:h 42
 
:h holy-grail
 
:h!
 
   
zzapper
 
, November 10, 2004 22:30
 
 
----
 
----
<!-- parsed by vimtips.py in 0.669275 seconds-->
 

Revision as of 00:56, 25 November 2007

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!'

Comments