chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Using csi within Vim to evaluate visually selected text


From: John Magolske
Subject: [Chicken-users] Using csi within Vim to evaluate visually selected text
Date: Sat, 2 Apr 2011 19:32:09 -0700
User-agent: Mutt/1.5.19 (2009-01-05)

Hi all,

Recently I've become interested in learning and using scheme. Liking
a lot of what I've seen of Chicken Scheme, I've settled on using this
implementation while working my way through SICP.

I use Vim and wanted to be able to visually select snippets of code
within a text file, run them through csi, then view the output in
Vim's command line area with the option of pasting that output into
the buffer below the selected text. Here's what I came up with...
In my vimrc there is:

  vmap <silent> <leader>c :w! /tmp/scheme-snippet<cr>}:!csi-vim-cmd<cr>:
  command I r !csi-vim-cmd

Where csi-vim-cmd is a shell script like:

  #!/bin/sh
  csi -q < /tmp/scheme-snippet | \
  sed -e s/^\#\;.*$// -e s/\#\;[0-9]*\>// -e s/^---\>.*$// -e /^$/d

It seems similar functionality must've already been implemented
somewhere, but searching about I didn't find anything. I know there
are various Vim scripts out there [1], but I just wanted something
simple so I could evaluate exercises as I typed up my notes. Being new
to scheme, it wouldn't surprise me if there are things that could be
fixed/improved. Any comments or suggestions are much appreciated.

BTW, if anyone's in the San Francisco Bay area & interested, we've
started a scheme meetup [2] on Sundays at the Noisebridge hackerspace.

[1] http://www.vim.org/scripts/script.php?script_id=2531
    http://www.vim.org/scripts/script.php?script_id=1079
    http://vim.sourceforge.net/scripts/script.php?script_id=221
    http://vim.sourceforge.net/scripts/script.php?script_id=2219

[2] https://www.noisebridge.net/wiki/Schemers
    
https://www.noisebridge.net/pipermail/noisebridge-discuss/2011-April/022411.html

Cheers!

John

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]