christoomey / vim-tmux-runner

Vim and tmux, sittin' in a tree...
MIT License
291 stars 37 forks source link

Running multiple lines in ipython with VtrSendLinesToRunner outputs empty lines #101

Open francescoboc opened 3 years ago

francescoboc commented 3 years ago

Ok, so this is really a minor issue, and I don't even now if it coming from this plugin or from ipython itself. Basically, I use a lot the VtrSendLinesToRunner to, well, send lines to the runner pane with an instance of ipython in it. I select some lines of code in v-line mode, and then I mapped :'<,'>VtrSendLinesToRunnerto a convenient keymapping. Everything works as it should, and it is really convenient for quick testing a code, however, after the lines are executed in ipython, there are some empty lines with the In[number] identifier that are repeated. Usually 4 times, but sometimes 3 or 2. For example:

In [40]: # temperature (in units of J)                                                                                                                                                                                                                                                                                                                                                                                                                                                               
In [41]: start, stop, step = 0.15, 0.61, 0.01                                                                                                                                                                                                                                                                                                                                                                                                                                                   
In [42]: temps = np.round(np.arange(start, stop, step),2)                                                                                                                                                                                                                                                                                                                                                                                                                                       
In [43]:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
In [43]:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
In [43]:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
In [43]: 

Here, the lines I visually selected from the code are the first 3. ipython ran them, but then there are 4 empty lines all with In [43]: written. As I said, it's not a big deal, but it kinds of messes up the history in ipython, as scrolling up quickly gets very long.

christoomey commented 3 years ago

Just to confirm, are you using the settings in python config?

francescoboc commented 3 years ago

Thanks for your quick answer @christoomey ! Yes, I have those 3 lines in my vimrc, and I am starting ipython with ipython --no-autoindent. Not completely sure about the readline support, however. I am on linux and that stackoverflow post refers to mac. BTW, if I send one line only to the runner pane, then there are no extra empty lines in ipython. It happens only when I send 2 or more lines.