From 4d32d662020b89a09b054c0d2ce06ba64f3016a2 Mon Sep 17 00:00:00 2001 From: zeekay Date: Thu, 19 Jan 2012 02:49:33 -0600 Subject: [PATCH] Stay in preview window when running code from there --- ftplugin/python/ipy.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ftplugin/python/ipy.vim b/ftplugin/python/ipy.vim index edd62fc..16ec192 100644 --- a/ftplugin/python/ipy.vim +++ b/ftplugin/python/ipy.vim @@ -180,15 +180,17 @@ def get_doc_buffer(level=0): vim.command('wincmd p') def update_subchannel_msgs(debug=False): - msgs = km.sub_channel.get_msgs() + startedin_vimipython = vim.eval('@%') == 'vim-ipython' vim.command('silent pcl') vim.command('botright 10 new vim-ipython') vim.command('setlocal modifiable noro') # subchannel window quick quit key 'q' vim.command('map q :q') + b = vim.current.buffer - for m in msgs: + + for m in km.sub_channel.get_msgs(): s = '' if 'msg_type' not in m['header']: # debug information @@ -236,8 +238,9 @@ def update_subchannel_msgs(debug=False): vim.command("set bufhidden=hide buftype=nofile ft=python") # indicate the output window as the current previewwindow vim.command('setlocal previewwindow nomodified') - # return from whence you came - vim.command('wincmd p') + if not startedin_vimipython: + # return from whence you came + vim.command('wincmd p') def get_child_msg(msg_id): # XXX: message handling should be split into its own process in the future