Monday, November 5, 2012

Re: Difficulty in using VIM

> lisp
Well - y - you really may want evaluate emacs instead, cause it was
written in Lisp thus it should have best support for it if the you can't
get REPL working with Vim or if it doesn't work well enough.
Using elvis you even get most vim keys. Looks like you did.

Emacs also shows web sites etc much better than Vim (even though
elinks -dump like hacks may be good enough) - because it is also a
kitchen sink.

> The program that I described is written in Emacs lisp, sbcl Common
> Lisp, Bigloo scheme, and a small portion in C (the public key stuff is
> in C). Emacs lisp uses call-process-region to trigger a Common Lisp
> program, that processes the text, and returns the result to the buffer
> that the lawyer is editing. In fact, the text looks more like a form,
> than a text. The lawyer fills the blanks.

> REPL
Vim is not that good at it. There are some hacks which still make it
work. But they all may cause minimal delays. vim-addon-async's README
lists several options.
Which OS is being used? Eg vim-addon-async works on nix like systems
only, python implementations might work well on windows, too.
vim-addon-async is cool, cause you can edit even the results easily only
keeping the lisp code you care about. But it has its own small isues.

> Basically, the lawyers need a text editor, that can run a process in a
> separate buffer/window, and call Common Lisp in another buffer/window.
> Internet server, Internet scripting, email handling, databases,
> everything is in Common Lisp.

Eventually tools like TexMacs are an option, too.
They inclued embedding external interpreters. Not sure about this
particular one, though.

> Since people say that Emacs is obsolete, difficult to use, and weird,
> I decided to investigate how well other IDE/editors handles the
> lawyers' program.
:) Flamewar? Special solutions always require special knowledge.

It depends on what matters most for the task Vim primarly is a text
editor. If you're done with some mappnigs, snippets etc Vim will serve
users well.

> and install appropriate plugins, etc. Besides this, Eclipse does not
> call a shell box as well as Emacs.
Eclipse does have features like REPL. Eventually try the #eclipse
chatroom (irc.freenode.net) or try to find a different forum.
Yes - its hard to always find the perfect plugin at the first try.

> Right now, I am trying VIM. The first thing I need is to open two
> windows in VIM.
<c-w>s or <c-w>v will split, or use tabs.

> editing. The other window runs the Lisp REPL. The lawyer switches from
> one windows to the other as the need may arise (in Emacs he does so
> with "Ctrl-x o").

:b *foo*<tab> or the like is teh builtin way.

<c-w> hjkl moves cursor from one window to the next
gt gT changes tabs.

If thats to complicated you can remap them. Eg I'm using
noremap <m-s-j> <c-w>j

so that moving cursor to the window below is one "accord" only.
I did the same for closing buffer etc.

> 1 -- I installed a program called SLIMV. The programs claims that it
> is as good as SLIME, the very same script that the law firm is using
> to run Common Lisp. However, SLIMV proved to be very ugly, and it is
> not working properly. When there is an error, I am not able to abort
> the debugger. In fact, slimv does not handle errors gracefully. That
> is the problem I found with slimv.
Again, the problem is that VIm does not have builtin async communication
support. Some python scripts or on idle poll solutions exist.

vim-addon-async catches <ctlr-c> and tries to send the interrupt signal
to the process - whether it listens to it is another story.

> 2 -- A vim user told me that vim is not supposed to handle screens,
> windows, shells, etc.
Yes/no. THere is a native patch for console vim (older version) which
has builtin terminal support. However then you can use "screen" command
in the shell (assuming you're on linux/osx).

THere are plugins which try to emulate it such as ConcqueTerm, but the
nyou can't use Vim keybindings, because each key is forwarded to the
"shell" or "lisp" intepreter.

> regions, put "rlwrap sbcl" in a region, and vim in the other. However,
> vim does not seem to behaved well within SCREEN. In other words, vim
> scrambles the text.
May depend on TERM setting.

By the way, you can also keep things separate:
use a tiling window manager such as awesome, wmii/dwm, ratpoisson
and just run a shell and an editor instance.

THere are xtest like tools which might be able to automate some simple X
tasks such as copy pasting, switching active windows etc.

> My expectations were quite high when I started to work with vim. I
> still hope that a seasoned vim user will teach me how to open a shell
> that works well inside a vim (text) terminal.
depends on the features you need. Vim is not emacs. Vim is primarly a
text editor only.

Summary: how REPL in Vim?
a) vim-addon-async (may crash ocassionally, making it autosave would be
simple)

b) slime (?)

c) ConqueTerm (terminal emulation, but no vim feeling, you have to take
care about being in insert mode, and you should not touch change the
display etc)

d) there are more options such as:
:'<,'>! external-app

pipe selected lines through external-app and insert its result.
You can script it. However this way you don't have state within the
interpreter because it gets restarted over and over again

...

e) See related work section here
https://github.com/MarcWeber/vim-addon-async
eg shellasync etc.
(This list may be incompplete)

f) use older vim with native terminal patch (I never used that)

...

Yes - all solutions have their flaws - but you can get used to them.


> By the way, I am not a lawyer myself. I too hate lawyers.
Well - open source/ charity ware also needs lawyer sometimes :)
And I don't think that all lawyer are evil. It may happen that they are
asked to du such jobs often.
If we find a solution to make you happy you can still say thanks by
donating: http://www.vim.org/sponsor/index.php

> if you help me, you are not helping a lawyer directly. In fact, your
> answer will be used mostly for my own edification.
:) Shouldn't this sentence be the first one?

Good luck - as always - there may be additional replies - providing more
insight.

I hope this has helped you.
Marc Weber

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