On 06/11/12 14:06, Ed Kostas wrote:
> 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.
>
I use F11 to go to the next (or previous) window, as follows:
:noremap <F11> <C-W>w
:noremap! <F11> <C-O><C-W>w
:noremap <S-F11> <C-W>W
:noremap! <S-F11> <C-O><C-W>W
With a count, they go to the nth window from top, not the nth window
from the current one.
In general, function keys F1-F12 (with or without Shift etc.) are the
"safest" ones to use as the {lhs} of a Vim mapping, they aren't (except
F1 and sometimes F10) bound to anything by default, unlike most of the
other keys. Some of them (Shift-Alt-Fn and sometimes Alt-Fn on Linux)
might be preempted by the OS, but in my experience Fn (without modifier)
and Shift-Fn will (in most OSes) be passed to the application.
Lisp commands to copy and paste in Vim? Hm, there's no accounting for
tastes I suppose. Next we'll see mappings for
Esc-Meta-Alt-Ctrl-Shift-something… (and, yes, I found that acronym on
the same page as VI-VI-VI for the Editor of the Beast; VIM-VIM-VIM might
perhaps be the Editor of the Thousandfold Beast?)
Best regards,
Tony.
--
In Memphis, Tennessee, it is illegal for a woman to drive a car unless
there is a man either running or walking in front of it waving a red
flag to warn approaching motorists and pedestrians.
--
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
Tuesday, November 6, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment