Monday, November 5, 2012

Re: Difficulty in using VIM

> What I need now is a script that prevents user from entering the command mode when the cursor is on the REPL window.
Looks like you're learning fast :) You got the main point.
Now that you understood the issue you can even cope with it.
Happy vimming ..

If you prevent it you loose the ability to copy paste within vim, do you
want this? Eg copy the output to another buffer.

If at all I'd remap <esc> to <esc><c-w>w so that the cursor moved to the
next window.. because otherwise you have to use <c-o> or <c-r>=.. hacks
to put the cursor into another window (using the keyboard).

By the way here it only gets messed up using o/O. When using ia the
cursor is put where it previously.

Because you know Vim now, you also understand that using "vim" mappings
for inserting and editing text is important for vimmers which is why
ConqueTerm may not be the perfect fit at all..

Anyway: back to the roots: If you need a terminal & vim why not just use
a terminal and vim?
Eg konsole supports tabs and split view as shown here:
http://www.pclinuxos.com/forum/index.php?topic=79651.0
(screet would do the same, kind of)

The editor, rlwrap and sbcl go crazy if I enter command mode on the REPL
window.

He/she must switch windows using Ctrl-O Ctrl-ww. I believe that
it is not difficult to write a script that will inhibit command mode on
the REPL window. Is it possible to remap the keys on the REPL window
only?
Yes:

fun! My()
ConqueShell ...
noremap <buffer> {lhs} {rhs}
endf
call My()

as mapping: map xx :call My()<cr>
then xx will start conque (and do the mapping)
as command: command -nargs=0 My call My()
then :My will start conque (and do the mapping)

Of course you could also use auto command - but maybe they are overkill,
cause you eventually only want this ConqueTerm behaviour when using that
lisp REPL.

> I suppose there is a way to give a tag to the REPL window. Then one
> could remap the ESC key.
Yes: buffer vars: let b:my_tag = 1 if exists('b:my_tag') ...
Or use map <buffer> as shown previously.

I'd still recommend you having a quick glance at vim-addon-async, too.
Its deafult is to see a vim buffer like a vim buffer - editing is the
default - and you visually select text hitting enter to sent it to the
stdin of your repl.

If you have a look at the python/ruby implementation you seet hat even
vim's completion can be supported (which requires little work, though)

Of course there is no longer the <up> history, <c-h> open a vim managed
history instead.

The main difference is that its much easier to use all the vim goodies:
mapping, abbreviations, snippets, completions, ...
Eg there are plugins helping with brackets, you can use % to jump from (
to ) and much more.

Anyway - looks like you're very close to managing this yourself.

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: