François Pinard wrote: 
  >[stri ker]
  >
  >> I frequently need to do some basic calculations.  [...] Is
  >> there a way to do calculations with doubles instead of integers
  >> without piping to an external program like bc and then
  >> inserting into  a buffer?
  >
  > If you are lucky enough to have a Python-enabled Vim, 
  > you may use:
  >
  >   :py print 3.7 * 4.5
  >
  > and read the result (16.65) in the echo area.
 
  Here's how I have set things up for perl-enabled vim:  

    " evaluate numerical expression in unnammed buffer 
    " and echo and append result
    nmap \e :perl my $foo = eval(VIM::Eval('@*')); 
                  \ VIM::DoCommand("let @* = '" . $foo . " '" ); 
                  \ my @pos = $curwin->Cursor(); 
                  \ $curbuf->Append($pos[0], $foo); 
                  \ VIM::Msg($foo);<CR>


  --Suresh

Reply via email to