Saturday, March 26, 2011

Re: Grab text in command-line area & insert it to the buffer text?

* John Magolske <listmail@b79.net> [110325 21:15]:
>
> " run visually selected text through the chicken scheme interpreter
> vmap <silent> <leader>c :w! /tmp/scheme-snippet<cr>:!csi-vim-cmd<cr>
>
> where csi-vim-cmd is a shell script like so:
>
> #!/bin/sh
> csi -q < /tmp/scheme-snippet | sed -e s/^\#.*$// -e s/^---\>.*$// -e /^$/d
>
> The output of what the selected code evaluates to is displayed in
> the command line area along with "Press ENTER or type command to
> continue". Pressing ENTER makes it go away, but I'd like to have the
> option of grabbing that output and inserting it after the selected
> text, say by pressing "i" rather than ENTER at that point.

These mappings seem to do the job:

" Run visually selected text through the Chicken Scheme Interpreter.
" Output is displayed in Vim's command line area. Pressing I then
" RETURN inserts the output into the buffer below the selected text.
vmap <silent> <leader>c :w! /tmp/scheme-snippet<cr>}:!csi-vim-cmd<cr>:
command I r !csi-vim-cmd

Regards,

John

--
John Magolske
http://B79.net/contact

--
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

No comments:

Post a Comment