Loading ...
Sorry, an error occurred while loading the content.
 

vim rpn calculator

Expand Messages
  • Bee
    ... It prints the result on the command line... THEN returns to vim. How do I return the value to vim? Is there an rpn calculator for vim? Bill -- -- You
    Message 1 of 31 , Nov 24, 2013
      From (linux or mac) vim I can use 'dc' a command line rpn calculator as:

      :!dc '-e 5 5 + 3 * p'

      It prints the result on the command line... THEN returns to vim.

      How do I return the value to vim?

      Is there an rpn calculator for vim?

      Bill

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bee
      After reading :help :put again and again, ... I reduced the RPN calc to a one line imap: (comments best viewed in monospaced font) imap ,= :put
      Message 31 of 31 , Nov 27, 2013
        After reading :help :put again and again,

        > :[line]pu[t] [x]
        > Put the text [from register x] after [line] (default current line).
        > ...
        > The register can also be '=' followed by an optional expression.
        > The expression continues until the end of the command.
        > You need to escape the '|' and '"' characters to
        > prevent them from terminating the command.
        > Example:
        > :put ='path' . \",/test\"


        I reduced the RPN calc to a one line imap:
        (comments best viewed in monospaced font)


        imap ,= <esc>:put =system('dc \"-e2k'.getline('.').'n\"').' '<cr>A
        " ''''' | | || | | | | | | +eol
        " ''''' | | || | | | | | +run imap
        " ''''' | | || | | | | +concat space
        " ''''' | | || | | | |
        " ''''' | | || | | | +concat print command
        " ''''' | | || | | +concat calc text
        " ''''' | | || | +precision
        " ''''' | | || +build shell command
        " ''''' | | |+output shell command
        " ''''' | | +expression register
        " ''''' | +result after current line
        " ''''' +normal


        Now I do not need to prevent screen redraw
        and do not need to save/restore a register.

        Bill

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.