insert result from echo

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

insert result from echo

Zbigniew Kowalski

I'm using 'echo' in command line as a simple calculator, eg i do
:echo 7*13-23 <enter>
and the result pops up on the screen.

Is there any simple way to insert the result directly into text?
Something like:
:r !echo <expr>

regards
Zbikow


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: insert result from echo

Eric-212

Zbikow a écrit :
> I'm using 'echo' in command line as a simple calculator, eg i do
> :echo 7*13-23 <enter>
> and the result pops up on the screen.
>
> Is there any simple way to insert the result directly into text?
> Something like:
> :r !echo <expr>
>  
In insert mode, <CTRL-R>=7*13-23
see :help i_^R
Regards
Eric



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: insert result from echo

Jürgen Krämer-4
In reply to this post by Zbigniew Kowalski


Hi,

Zbikow wrote:
> I'm using 'echo' in command line as a simple calculator, eg i do
> :echo 7*13-23 <enter>
> and the result pops up on the screen.
>
> Is there any simple way to insert the result directly into text?
> Something like:
> :r !echo <expr>

while you are in insert mode enter

  <c-r>=7*13-23<cr>

See

  :help i_CTRL-R
  :help quote=

for more information.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

RE: insert result from echo

Gene Kwiecinski

>while you are in insert mode enter
> <c-r>=7*13-23<cr>

Hah!  Pretty good, learned something new today, too!  :D

I use ^R all the time to recall search patterns and stuff, but didn't
use it for anything like this.  Aways dragged out my phone and used its
calculator function to do stuff like that, then manually typed in the
result.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---