-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python REPL IndentationError: unexpected indent #38
Comments
Is removing the indentation necessarily behavior you would want? This seems like more of an issue with the Python REPL. I know Ipython used to have this problem with throwing an indentation error when only one line was used (and indented), but it was fixed somewhat recently. |
Isn't this the expected behavior? I think i'ts generally a good idea to "normalize" indentation, regardless what REPL you are using. I tried it with Ubuntu 14.04 default python 2.7.6 |
Maybe it's what you want if you happen to be sending the line to a Python REPL, but you could be sending it anywhere. If, for example, you were sending it to another text document open in that tmux pane, you might want to keep the inherent indentation level. There's no way for slimux to know what kind of environment you're sending the line to, so I believe maintaining the indentation is generally correct. Maybe a compromise would be a setting one could tweak to change the escaping behavior to dedent lines. I'm not familiar with the escaping process in slimux, but that would give you what you're looking for. |
The README states:
From this, I would think if I have a python file opened, then a corresponding hook will take care of fixing the indentation. But even if it's not true, I'd think 99% of people use these kind of tmux copying plugins to interact with REPLs. So in my eyes this is unnecesarily sacrificed functionality just to be general enough. |
I think it'd be useful to remove all preceding levels of indentation from all lines up to when one line is found to have reached the position 0. This would enable people to test blocks of code from within functions etc. This would address the issue @kmARC ? I'll try to work on a solution for this. |
👍 Good idea. |
@slashfoo, I originally thought that it works like this, so yepp, I'd be happy if this would be implemented :-) |
Good idea, @slashfoo |
I haven't had much time to whip something up for this, but it's still on my queue! If anyone can get to it before I can, I'd be happy to test their PR tho :D |
Hello, I added this in the ftplugin/python.vim :
|
I actually had this requirement for a long time and had a working version for years. But I wasn't sure whether it should be included by default or not. Now I think it is the good time to send a PR. @slashfoo Would you please help to test? Thanks! |
Tested that
|
Hello, are the above PRs ever going to get merged in? |
Bump, I'd also like to see this :) |
As a workaround, the IPython console handles indentation well. |
Everything works as expected however when sending an indented line, slimux doesn't cut indentation according the first line as I'd expect after looking at slimux/ftplugin/python.vim
The output of
:scriptnames
lists the ftplugin, so I guess it's loaded. I tried sourcing it manually, still doesn't work.Test file:
:SlimuxREPLSendLine
on the second line has the problem.Vim log (truncated, started vim with -V9):
NerdTree before, eclim after, I am not sure whether it should display invoking SlimuxEscape_python.
The text was updated successfully, but these errors were encountered: