Tuesday, February 5, 2013

Re: Script to send selected text from Vim to R in Ubuntu

On 2013-02-05, Josef Montag wrote:
> Hi all,
>
> I have started using Ubuntu and try to figure out ways and tools
> for a simple script. I use Vim to write code for R and need a
> script that takes a selection in Vim and sends it to R and have
> this script attached to a key combination. I'm not sure whether
> this could all be done in Vimscript or I should look elsewhere.

To send a visually-selected region to the standard input of an
external program such as R, type the following

:w !R

which will appear on the command line as:

:'<,'>w !R

See

:help visual.txt
:help :w_c
:help 10.9

You can map a key combination to any sequence of Vim commands
including this one, for example,

:vmap <F3> :w !R<CR>

See

:help 05.3
:help 40.1
:help map.txt

HTH,
Gary

--
--
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@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: