Home > Archive > Scheme > May 2005 > Scheme and VI
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Karel Miklav 2005-05-18, 8:59 pm |
| From previous threads it looks like one can be a functional language
guy and a VImer at the same time. Could you please tell me how do you
send your selections/buffers from your favorite VI clone to the interpreter?
--
Thanks,
Karel Miklav
| |
| Matthias Buelow 2005-05-18, 8:59 pm |
| Karel Miklav wrote:
> From previous threads it looks like one can be a functional language guy
> and a VImer at the same time. Could you please tell me how do you send
> your selections/buffers from your favorite VI clone to the interpreter?
I've given up and use XEmacs for that (I'm a 10+ years heavy vi user
otherwise but have been using emacs on and off over the time aswell so
it hasn't really been alien to me). However, in that regard, emacs is
hardly optimal and only a small step up from what the vi clones offer,
in functionality. One of the major drawbacks, apart from the
all-permeating horror that is Emacs, is that you can only have one
Lisp/Scheme buffer running and have to start other Schemes in xterms (or
ordinary shell buffers) if you need more (which I usually do).
But for the vi camp... basically, if you have gvim (GUI version), it's
quite comfortable; just use ordinary cut&paste. Works pretty well
(double-clicking on parens selects them and the enclosed text, also
available via keybindings). Also, vim's Lisp/Scheme indentation is
quite well working (with the exception of parens in comments, which can
throw the matcher off track) and you can configure it a bit (via the
"lispwords" variable). Original vi's also got a Lisp mode but it's very
primitive and not configurable and probably only of historical interest.
Some vi workalikes such as nvi or vile don't have a Lisp mode
implemented and are therefore only for those hardcore people who
consider automatically indented s-expressions licentious decadence.
Interacting with an interpreter in a terminal-only vi is painful, if the
stuff you paste is longer than a page, or if you cannot paste at all, so
I recommend using the gui version, if possible.
<rant>Unfortunately, gvim can open only one (1) gui window, which I find
pretty limited. I never understood why they didn't give it the
possibility of opening multiple gui windows, like (X)Emacs, or virtually
any other GUI editor out there. It's not that they're feature-averse,
quite the contrary, vim is a monstrous feature dump but apparently it's
either not easily doable within vim's architecture, or their brains are
simply ticking differently from mine and they don't consider it
important enough.</rant>
mkb.
| |
| Sunnan 2005-05-19, 4:00 am |
| Matthias Buelow <mkb@incubus.de> writes:
> One of the major drawbacks, apart from the all-permeating horror
> that is Emacs, is that you can only have one Lisp/Scheme buffer
> running and have to start other Schemes in xterms (or ordinary shell
> buffers) if you need more (which I usually do).
Nope, use M-x rename-buffer, rename the scheme buffer, then start a
new one with M-x run-scheme. Good luck with Emacs!
Sunnan
--
..i mi'e snan .i mi rodo roda fraxu
| |
| Ulrich Hobelmann 2005-05-19, 4:00 am |
| Karel Miklav wrote:
> From previous threads it looks like one can be a functional language
> guy and a VImer at the same time. Could you please tell me how do you
> send your selections/buffers from your favorite VI clone to the
> interpreter?
I think with "!" you can send several lines from the buffer to a
program. That program could for instance pipe its stuff to the
interpreter, via a named pipe etc. (so you would run scheme as
"scheme < named-pipe"). Well, then there's that input problem
again, so maybe you need another program inbetween that reads from
both stdin and the pipe...
Happy C coding ;)
--
Don't let school interfere with your education. -- Mark Twain
| |
| Jens Axel Søgaard 2005-05-19, 8:57 am |
| Karel Miklav wrote:
> From previous threads it looks like one can be a functional language=20
> guy and a VImer at the same time. Could you please tell me how do you=20
> send your selections/buffers from your favorite VI clone to the=20
> interpreter?
I haven't tried it, but this version of VI might be interesting:
<http://iamphet.nm.ru/scheme/>
--=20
Jens Axel S=F8gaard
| |
| Nils M Holm 2005-05-19, 8:57 am |
| Karel Miklav <karel@lovetemple.adbloccker.net> wrote:
> From previous threads it looks like one can be a functional language
> guy and a VImer at the same time. Could you please tell me how do you
> send your selections/buffers from your favorite VI clone to the interpreter?
Use two xterms: one for editing in vi, one running the Scheme interpreter.
To run your code, save, switch windows, load the file into the interpreter
and run.
To evaluate a single expression, use '!%interpreter' and 'u'. '!%' sends
everything between two matching parens to 'interpreter'. The 'u' undoes
the previous command.
Nils
--
Nils M Holm <nmh@despammed.com> http://www.holm-und-jeschag.de/nils/
Symbolic Computing - an Introduction to Pure LISP: http://www.t3x.org/scipl/
| |
| Karel Miklav 2005-05-19, 8:57 am |
| Matthias Buelow wrote:
> <rant>Unfortunately, gvim can open only one (1) gui window, which I find
> pretty limited. I never understood why they didn't give it the
> possibility of opening multiple gui windows, like (X)Emacs, or virtually
> any other GUI editor out there.
I remember using the Project + Minibufexpl scripts at the same - real
window managing nightmare. Maybe that's what bothers you?
| |
| Karel Miklav 2005-05-19, 8:57 am |
| Ulrich Hobelmann wrote:
> I think with "!" you can send several lines from the buffer to a
> program. That program could for instance pipe its stuff to the
> interpreter, via a named pipe etc.
There are named pipes? Wow, that gives my I/O redirection fiddlings a
new dimension :) Anyway, I'm glad I asked, lots of interesting replies.
Thanks Ulrich, thanks people.
Karel Miklav
| |
| Holger Peters 2005-05-19, 8:57 am |
| Karel Miklav wrote:
> From previous threads it looks like one can be a functional language guy
> and a VImer at the same time. Could you please tell me how do you send
> your selections/buffers from your favorite VI clone to the interpreter?
>
> --
>
> Thanks,
> Karel Miklav
Hi,
In most cases the following command fits your needs (works with vim,
don't know other implementations).
:w !myschemeinterpreter
This works for guile at least:
:w !guile
It passes the content of the current buffer via stdout into the
interpreter myschemeinterpreter. (Attention, there is a space in front
of the !)
:w !! repeats the last :w !app command
(This does not save your work though, so be sure to save your files)
Alternatively, you can run normal shell commands:
:!myschemeinterpreter interpreter-params
:!! repeats the last :!... command
so regularly, I use
:!guile -s myfile.scm
Holger
| |
| R. Mattes 2005-05-19, 8:57 am |
| On Thu, 19 May 2005 01:04:31 +0200, Matthias Buelow wrote:
> Karel Miklav wrote:
>
>
> I've given up and use XEmacs for that (I'm a 10+ years heavy vi user
> otherwise but have been using emacs on and off over the time aswell so
> it hasn't really been alien to me). However, in that regard, emacs is
> hardly optimal and only a small step up from what the vi clones offer,
> in functionality. One of the major drawbacks, apart from the
> all-permeating horror that is Emacs, is that you can only have one
> Lisp/Scheme buffer running and have to start other Schemes in xterms (or
> ordinary shell buffers) if you need more (which I usually do).
??? Where did you get _this_ from? I'm currently running emacs with
SLIME and have several Lisp buffers open (to 3 different Lisp at the
same time). I don't know about quack.el capabilites but i don't see
where emacs should limit the number of buffers.
Ralf Mattes
| |
| Matthias Buelow 2005-05-19, 4:02 pm |
| Sunnan wrote:
> Nope, use M-x rename-buffer, rename the scheme buffer, then start a
> new one with M-x run-scheme. Good luck with Emacs!
That won't help with anything since scheme mode apparently will always
send expressions to a buffer named "*scheme*".
mkb.
| |
| Matthias Buelow 2005-05-19, 4:02 pm |
| R. Mattes wrote:
> ??? Where did you get _this_ from? I'm currently running emacs with
> SLIME and have several Lisp buffers open (to 3 different Lisp at the
> same time). I don't know about quack.el capabilites but i don't see
> where emacs should limit the number of buffers.
I don't know about SLIME, I was talking about the ordinary (CMU?) scheme
or default lisp mode.
mkb.
| |
| Matthias Buelow 2005-05-19, 4:02 pm |
| Ulrich Hobelmann wrote:
> I think with "!" you can send several lines from the buffer to a
> program. That program could for instance pipe its stuff to the
> interpreter, via a named pipe etc. (so you would run scheme as "scheme <
> named-pipe"). Well, then there's that input problem again, so maybe you
> need another program inbetween that reads from both stdin and the pipe...
I've done that with a tiny shell script and xcut(1) but the problem is
that it pipes the output back into the editor, so the current buffer
will always be modified, even if nothing has changed really. That might
be annoying after a while.
mkb.
| |
| Ulrich Hobelmann 2005-05-19, 4:02 pm |
| Matthias Buelow wrote:
> Ulrich Hobelmann wrote:
>
>
>
>
> I've done that with a tiny shell script and xcut(1) but the problem is
> that it pipes the output back into the editor, so the current buffer
> will always be modified, even if nothing has changed really. That might
> be annoying after a while.
True. I'm suggesting an output-only program that simply feeds
your input set to the interpreter and then returns. The
interpreter output would be written to stdout, as you started it
from the shell.
Scheme runs from pipe to stdout; an input program runs from one
named pipe and stdin to the scheme pipe; and the program invoked
by "!" in vi could write to the middle program's pipe.
Complicated, but I hope that would work.
Well, I'm fine with emacs though...
--
Don't let school interfere with your education. -- Mark Twain
| |
| Bradd W. Szonye 2005-05-19, 4:02 pm |
| Karel Miklav wrote:
I usually use Vim+Scheme the same way I use Vim+Perl, using my Scheme
interpreter's batch/script mode instead of the REPL. I write my code in
a source file and (frequently) switch to an xterm to test it. Even
though I originally learned to program in a REPL-style environment (the
Commodore BASIC interpreter), it no longer seems natural to me. I find
that editors make for crappy command terminals and vice versa; better to
use each tool for what it does best.
Vim is a pretty good Scheme editor, and xterm is a good command
terminal. Vim is a lousy REPL platform, and REPLs are poor editors, even
when you give them fancy readline-type capabilities. Emacs tries to do
both jobs well -- strike that, emacs tries to do everything well, which
is why its nickname is "Eight Megabytes and Constantly Swapping." I
personally prefer the specialized-tools approach to the Swiss Army knife
approach.
Matthias Buelow wrote:[color=darkred]
> But for the vi camp... basically, if you have gvim (GUI version), it's
> quite comfortable; just use ordinary cut&paste. Works pretty well
> (double-clicking on parens selects them and the enclosed text, also
> available via keybindings).
Yeah, that works, if you really want to use a REPL. I actually like the
scripting approach better; every run is fresh, without cruft hanging
around from your earlier experiments. Even edit-compile-run is painless
for small projects, when you use a decent command terminal and shell.
> Also, vim's Lisp/Scheme indentation is quite well working (with the
> exception of parens in comments, which can throw the matcher off
> track) and you can configure it a bit (via the "lispwords" variable).
If you're really ambitious, you can customize the indentation and syntax
highlighting as much as you want. I wasn't quite happy with Vim's built-
in Scheme highlighter, so I wrote my own. I was even planning to take
over the Scheme syntax from the current maintainer until I got
distracted by something shiny and abandoned the project.
> Unfortunately, gvim can open only one (1) gui window, which I find
> pretty limited.
I'm guessing that you mean only one main window per vim process? Unlike
some editors, you can reasonably run as many vim processes as you want,
and you can even cut and paste between them using the global buffer ("+)
for cut ("+x), copy ("+y), and paste ("+p). I usually use one main
window for each group of related files, each in its own pane.
--
Bradd W. Szonye
http://www.szonye.com/bradd
| |
| Matthias Buelow 2005-05-19, 4:02 pm |
| Ulrich Hobelmann wrote:
> True. I'm suggesting an output-only program that simply feeds your
> input set to the interpreter and then returns. The interpreter output
> would be written to stdout, as you started it from the shell.
That won't work since vi replaces the text it pipes to the command after
"!" with the output of that command (! acts as a filter). So if your
pipeline doesn't output anything, the piped text range gets deleted.
You have to echo back what you read, then the text is the same but the
buffer is now marked as modified.
mkb.
| |
| Gary D. Duzan 2005-05-19, 4:02 pm |
| In article <d6gc4j01dmn@enews1.newsguy.com>,
Karel Miklav <karel@lovetemple.adbloccker.net> wrote:
> From previous threads it looks like one can be a functional language
>guy and a VImer at the same time. Could you please tell me how do you
>send your selections/buffers from your favorite VI clone to the interpreter?
I tend to use "screen" in an xterm to work on things. In this
case, the interpreter could be running in one screen and vi in
another. To move data between screens I generally use X mouse cut
and paste for convenience, but screen has a built in cut and paste
facility for when you don't have a mouse handy, and it would work
just as well.
Gary Duzan
BBN Technologies
| |
| Joe Marshall 2005-05-19, 8:58 pm |
| "Bradd W. Szonye" <bradd+news@szonye.com> writes:
> Vim is a pretty good Scheme editor, and xterm is a good command
> terminal. Vim is a lousy REPL platform, and REPLs are poor editors, even
> when you give them fancy readline-type capabilities. Emacs tries to do
> both jobs well -- strike that, emacs tries to do everything well, which
> is why its nickname is "Eight Megabytes and Constantly Swapping."
Hmm. My emacs is currently at 42 megabytes (I've been debugging and
one of my trace buffers has more than 3MB ). But even at 42 Mb,
that's less than 10% of my available free memory. I'm not even close
to swapping.
| |
| Matthias Buelow 2005-05-20, 4:01 am |
| >>??? Where did you get _this_ from? I'm currently running emacs with
>
> I don't know about SLIME, I was talking about the ordinary (CMU?) scheme
> or default lisp mode.
Ok, I've looked it up now, some comments:
* There doesn't seem to be an Xemacs package, from my experience it's a
bit bothersome often to get it to work then (but that can probably be
overcome).
* It looks a bit complicated; it seems to be more of a full-fledged
Lisp IDE in the style of those Visual XXX things from the Windows world.
That's much more than what I (currently) need (or want). I'm satisfied
with the functionality of ordinary scheme/lisp-mode, with the exception
of the limitation of one repl buffer (which is only a mild annoyance,
however).
* Does it support Scheme at all? I only see Common Lisp on that webpage.
mkb.
| |
| rsheridan6@gmail.com 2005-05-20, 4:01 am |
| True, but you can cut and paste, just like people apparently do with
vi. It probably wouldn't be difficult, with a little knowledge of
Emacs Lisp, to come up with a better solution.
| |
| R. Mattes 2005-05-20, 8:58 am |
| On Fri, 20 May 2005 02:49:56 +0200, Matthias Buelow wrote:
> [...]
>
> Ok, I've looked it up now, some comments:
>
> * There doesn't seem to be an Xemacs package, from my experience it's a
> bit bothersome often to get it to work then (but that can probably be
> overcome).
I'm not an Xemacs user any more but from the ppostings of the mailing
list i guess it seems to work with Xemacs as well.
> * It looks a bit complicated; it seems to be more of a full-fledged
> Lisp IDE in the style of those Visual XXX things from the Windows world.
> That's much more than what I (currently) need (or want). I'm satisfied
> with the functionality of ordinary scheme/lisp-mode, with the exception
> of the limitation of one repl buffer (which is only a mild annoyance,
> however).
It's as complicated as you make it :-) If you only want a REPL, just only
use that (m-x slime is all you need then). But you can have as many as you
want or need. And once you need a class browser/inspector/hyperspec lookup
etc. you have it at the tips of your fingers. Belive me, once you've
discovered these things you'll miss them.
> * Does it support Scheme at all? I only see Common Lisp on that
> webpage.
Never worked on that. I guess none of the Schemers is working on it. All
it really needs is a scheme with socket support (and some introspection/
MOP iff you want the fancy stuff).
But, for Scheme, i'd first look at quack.el -- there might be support for
multiple Scheme repls in there already.
Cheeers Ralf Mattes
> mkb.
| |
| Bradd W. Szonye 2005-05-20, 4:00 pm |
| "Bradd W. Szonye" <bradd+news@szonye.com> writes:
Joe Marshall <jrm@ccs.neu.edu> wrote:[color=darkred]
> Hmm. My emacs is currently at 42 megabytes (I've been debugging and
> one of my trace buffers has more than 3MB ). But even at 42 Mb,
> that's less than 10% of my available free memory. I'm not even close
> to swapping.
OK, so the old joke needs an update to account for modern software bloat!
--
Bradd W. Szonye
http://www.szonye.com/bradd
| |
| Matthias Buelow 2005-05-20, 4:00 pm |
| Bradd W. Szonye wrote:
>
> OK, so the old joke needs an update to account for modern software bloat!
I recommend one of the new Java IDEs... they make emacs look like
/bin/ed in comparison.
mkb.
| |
| Ulrich Hobelmann 2005-05-20, 4:00 pm |
| Matthias Buelow wrote:
> Bradd W. Szonye wrote:
>
>
>
> I recommend one of the new Java IDEs... they make emacs look like
> /bin/ed in comparison.
And not only in RAM consumption and slowness, but also in user
interface complexity and screen space usage!
Hooray for progress!
--
Don't let school interfere with your education. -- Mark Twain
|
|
|
|
|