Tuesday, November 6, 2012

Re: Difficulty in using VIM

On Tuesday, November 6, 2012 12:50:49 AM UTC-2, MarcWeber wrote:
> > What I need now is a script that prevents user from entering the command mode when the cursor is on the REPL window.
>
>
> 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

Hi, Marc.

Both your suggestions worked fine. I mean, I installed konsole in a machine, and was able to run vim on a tab, and rlwrap sbcl on another tab, both visible.

The script also worked. However the script is slightly more complex than I thought. The problem is that rlwrap disables the Ctrl key. By the way, that is the reason for rlwrap preventing the debugger from going crazy. The solution I found was to map the semicolon, that is comment in Lisp, as the key that sends the focus to the text window. Of course, I need to quit vim from the text window. As for copy and paste, one can perform both operations with Lisp commands.

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