brunobeltran / conque

Automatically exported from code.google.com/p/conque
0 stars 0 forks source link

python script errors when entering conque window #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

" I added the following to my vimrc:
---------------
let g:ConqueTerm_CWInsert = 1       " allow <c-w> to work in insert mode
let g:ConqueTerm_InsertOnEnter = 1
function MyConqueStartup(term)
    inoremap <silent> <buffer> <C-j> <Esc><C-w>j<C-w>_
    inoremap <silent> <buffer> <C-k> <Esc><C-w>k<C-w>_
endfunction
call conque_term#register_function('buffer_leave', 'MyConqueStartup')
---------------

I like to have a lot of horizontally split windows and I use <c-j> and <c-k> to 
move between them.  I wanted this to work in insert mode in my conque shell 
rather than getting stuck in the shell when repeatedly moving up or down across 
my open windows (with <c-j> and <c-k>).

What is the expected output? What do you see instead?
When I use these mappings to move across my horizontally split windows, when I 
enter my conque shell I see lots of python errors that I should not see.

What version of the product are you using? On what operating system?
r458 on linux

Please provide any additional information below.

Original issue reported on code.google.com by the.ashl...@gmail.com on 17 Mar 2011 at 4:49

GoogleCodeExporter commented 9 years ago
I left out a line in MyConqueStartup:
--------

function MyConqueStartup(term)
    inoremap <silent> <buffer> <C-w>_ <Esc><C-w>_i
    inoremap <silent> <buffer> <C-j> <Esc><C-w>j<C-w>_
    inoremap <silent> <buffer> <C-k> <Esc><C-w>k<C-w>_
endfunction

Original comment by the.ashl...@gmail.com on 17 Mar 2011 at 4:53

GoogleCodeExporter commented 9 years ago
when I do <c-j> and <c-k> I want it to maximize my windows so that's why I have 
the <c-w>_ tacked on to the maps.

I saw a problem that I would not enter insert mode (maybe another bug) when I 
did this.

So I added the 'i' after the <c-w>_ mapping.  Thats when the python errors 
showed up.

Original comment by the.ashl...@gmail.com on 17 Mar 2011 at 4:55

GoogleCodeExporter commented 9 years ago
Looks like the main problem is that you're using the wrong hook. The 
'buffer_leave' hooks are called when you're exiting a Conque buffer. You want 
to define your new mappings when the Conque buffer is initialized.

The 'after_startup' hook will work for this.

I also just added a 'after_keymap' hook if you want to be really specific. E.g.:

function MyConqueMappings(term)

    inoremap <silent> <buffer> <C-j> <Esc><C-w>j<C-w>_
    inoremap <silent> <buffer> <C-k> <Esc><C-w>k<C-w>_

endfunction

call conque_term#register_function('after_keymap', 'MyConqueMappings')

This worked as expected for me.

Original comment by nicora...@gmail.com on 17 Mar 2011 at 5:38

GoogleCodeExporter commented 9 years ago
I've just down loaded r460.  I'm not seeing any fix.  Here's what I have:

----------
let g:ConqueTerm_CWInsert = 1       " allow <c-w> to work in insert mode
let g:ConqueTerm_InsertOnEnter = 1

function MyConqueKeyMappings(term)
    inoremap <silent> <buffer> <C-w>_ <Esc><C-w>_
    inoremap <silent> <buffer> <C-j> <Esc><C-w>j<C-w>_
    inoremap <silent> <buffer> <C-k> <Esc><C-w>k<C-w>_
endfunction
call conque_term#register_function('after_keymap', 'MyConqueKeyMappings')
----------

when I <c-j> into the conque window, the conque window is correctly expanded, 
however I don't InsertOnEnter, and when I do 'i'nsert I see the same errors.

Original comment by the.ashl...@gmail.com on 17 Mar 2011 at 7:22

GoogleCodeExporter commented 9 years ago
Ah, I think I misunderstood the problem. The correct way to handle this will 
depend on your global mappings for <C-j> or <C-k>. In other words the mappings 
being called when you're not in a Conque buffer.

This works for me, assuming your global mappings end with "i". Notice that 
InsertOnEnter is commented out, it will break if on.

let g:ConqueTerm_CWInsert = 1
"let g:ConqueTerm_InsertOnEnter = 1

inoremap <C-j> <Esc><C-w>j<C-w>_i
inoremap <C-k> <Esc><C-w>k<C-w>_i

" over-write Conque Mappings for <C-j> and <C-k>
function MyConqueMappings(term)

    inoremap <buffer> <C-j> <Esc><C-w>j<C-w>_i
    inoremap <buffer> <C-k> <Esc><C-w>k<C-w>_i

endfunction

call conque_term#register_function('after_keymap', 'MyConqueMappings')

I still haven't been able to see any python errors, however. Is this *nix or 
Windows, and what version of python are you using (2 or 3)?

Original comment by nicora...@gmail.com on 17 Mar 2011 at 8:37

GoogleCodeExporter commented 9 years ago
My global mapping is:

set winminheight=0
map  <C-J> <C-W>j<C-W>_
map  <C-K> <C-W>k<C-W>_

I don't want it to put me in insert mode except when I am entering a conque 
shell window, and I would like to then still be able to get out of the conque 
shell with this while in insert mode.

Original comment by the.ashl...@gmail.com on 18 Mar 2011 at 12:38

GoogleCodeExporter commented 9 years ago
Still haven't been able to reproduce errors.

Original comment by nicora...@gmail.com on 15 Aug 2011 at 8:07