| 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright (c) 2006 Don Stewart - http://www.cse.unsw.edu.au/~dons |
| 4 | # adapted by Gareth Smith |
| 5 | # GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) |
| 6 | |
| 7 | # |
| 8 | # A shell script to be called from vim, to use the awsesome power of haskell |
| 9 | # string processing in everyday editing. |
| 10 | # |
| 11 | # Select the line you want to edit, and in vim, type: |
| 12 | # !!runwith f |
| 13 | # |
| 14 | # where f :: (Show a) => String -> a |
| 15 | # |
| 16 | # (Assuming your lambdabot is installed in $HOME/lambdabot) it will |
| 17 | # replace the line with (f line) |
| 18 | # |
| 19 | # Hint: If you find yourself using a particular function a lot, use: |
| 20 | # !!bot let |
| 21 | # to define it in lambdabot's local namespace. |
| 22 | # |
| 23 | # Isn't perfect yet - I'd like it if for functions f :: String -> String, that |
| 24 | # the returned String didn't have to pass through the show function, so we |
| 25 | # didn't get extraneous quote marks. For now, you can s/"//g them away though |
| 26 | # :) |
| 27 | # |
| 28 | |
| 29 | DECL=`cat` |
| 30 | cd $HOME/lambdabot |
| 31 | echo "run $* \"$DECL\"" | ./lambdabot 2> /dev/null | sed '$d;/Irc/d;s/lambdabot> //' |
| 32 |