Skip to content
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

Possible to send a line without indentation #358

Open
amcpherson opened this issue Apr 25, 2014 · 6 comments
Open

Possible to send a line without indentation #358

amcpherson opened this issue Apr 25, 2014 · 6 comments

Comments

@amcpherson
Copy link

When debugging a few lines of python code within a loop using SublimeREPL, it is necessary to unindent the code before sending the lines to sublimeREPL, otherwise the interpreter raises IndentationError. It would be nice if removal of the extraneous indentation were automatic, configurable, or another shortcut.

@hahla
Copy link

hahla commented Apr 16, 2015

+1 this makes it useless actually for me

@jrzaurin
Copy link

After navigating the web I ended up here wondering if anyone has ever solved this issue. It will be fantastic to send chunks of code within a function.

This is a reason why sometimes I end up using SendText and working in the terminal.

Any news on solving this issue?

Thanks!!

@ebrensi
Copy link

ebrensi commented Nov 17, 2015

+1

@jasonzhang8801
Copy link

Anyone have solution for mac? Thank you very much!

@tbenst
Copy link

tbenst commented Nov 19, 2015

@cfingerh
Copy link

cfingerh commented May 3, 2017

I used the solution suggested by tbenst above, but I also did modify my sublimeREPL to delete the extra spaces/indentation. It is not perfect but it worked for me.

In the text_transfer.py file I modified selected_lines

def selected_lines(self):
    v = self.view
    parts = []

    first_line = v.substr(v.lines(v.sel()[0])[0])
    empty_spaces = 0
    while first_line[empty_spaces] == " ":
        empty_spaces += 1

    for sel in v.sel():
        for line in v.lines(sel):
            parts.append(v.substr(line)[empty_spaces:])
    return "\n".join(parts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants