Closed toomey8 closed 10 years ago
Also handle blank lines in visual mode?
Hey @toomey8,
I just pushed up a branch with the fixes needed to support python and other languages with syntactic whitespace: https://github.com/christoomey/vim-tmux-runner/tree/cjt-python-fixes
Can you try it out? Use the following steps:
$ cd ~/.vim/bundles/vim-tmux-runner
$ git status # => check for local changes
$ git stash save # => store away the changes
$ git fetch origin
$ git checkout cjt-python-fixes
After that, add the configuration list in the Python section of the Readme to your vimrc
, and then you should be set to test interaction with a python REPL via VTR.
@toomey8 I've pushed an update to the readme to fix the issue with the configuration settings. Can you test again to confirm all works?
As for the extra lines in the REPL, you might want to try switching off the AppendNewLine
functionality by setting:
let g:VtrAppendNewline = 0
and comment back with your findings?
With:
let g:VtrAppendNewline = 0
it hangs if I run just the loop, i.e.
if x == 10:
print ("test")
works if I run with an extra line it works
Note also that if I have a function with a line in it before the end it is failing, i.e.
ret_column = [] for element in input_column: try: ret_column.append(func(element)) except: ret_column.append(None) return ret_column
ret_column = [] for element in input_column: try: ret_column.append(func(element)) except: ret_column.append(None)
return ret_column
Also, the below works in base OXS Python REPL but not Ipython for reasons I don't understand.
Not sure if this is TMR, Ipython or both, but thought I would document.
On Ipython it hangs on 'except' indentation
def silent_map(func, input_column): ret_column = [] for element in input_column: try: ret_column.append(func(element)) except: ret_column.append(None) return ret_column
OK, debugged this some:
If using this with ipython on OSX make sure you have the correct version of readlines
http://stackoverflow.com/questions/726449/installing-ipython-with-readline-on-the-mac
and then start iPython with 'ipython --no-autoindent'
this works like a trooper.
thanks, Chris, for your help on this! You are the best. I think you can close this issue with a note to include an extra line at the end of a function in ipython.
FYI I had trouble on a new installation of the Anaconda distribution getting this to work, but switched to a new strategy where I 'vip' to get the paragraph, write the chunk to a temporary file, and then source that with the below.
silent! normal :VtrSendCommand execfile('f.py')
This has the benefits of not cluttering the REPL and bypassing any readline problems with Anaconda ipython.
Plugin strips whitespace. Can we have an option for not doing so for Python?