Wikia

Vim Tips Wiki

Changes: Calculator and code evaluation using Perl

Edit

Back to page

m (Reverted edits by Emprego.curitiba (talk | block) to last version by JohnBot)
 
Line 44: Line 44:
   
 
----
 
----
 
 
[http://www.vipsexshop.com.br Sex Shop]
 
[http://www.requintesexshop.com.br Sex Shop]
 
[http://www.sexshop.com.vc Sex Shop]
 
[http://www.belasexshop.com.br Sex Shop]
 
[http://www.belasexshop.com Sex Shop]
 
[http://blog.vipsexshop.com.br Dicas de Sexo]
 
[http://www.viplingerie.com.br Lingerie]
 
[http://www.vipcalcinhas.com.br Calcinhas]
 
[http://www.uniformesbr.com Uniformes Profissionais]
 
[http://www.uniformesbr.com Uniformes]
 

Latest revision as of 14:46, November 8, 2011

Tip 1359 Printable Monobook Previous Next

created October 17, 2006 · complexity basic · author Michael Hooreman · version n/a


This is a Perl variation of VimTip1235.

You can calculate with Perl inside Vim, and do more by adding the following to your vimrc:

:command! -nargs=+ Evaluate :perl VIM::Msg(eval{<args>})

This prints the last statement value of the provided code as argument, so you can do more than a calculation.

Examples:

:Evaluate 1+2
 > 3

:Evaluate sin(0)
 > 0

:Evaluate $a=sin(0);$a==sin(0)?"equal":"not equal"
 > equal

:Evaluate @a=(0..10); join "", map{$_%2?"-":$_}@a;
 > 0-2-4-6-8-10

CommentsEdit

An alternative is VimTip1349.

Does not need Python nor Perl.


Around Wikia's network

Random Wiki