Sublime Forum

Start SublimeREPL at startup by default

#1

I am using Sublime Text 3 with SublimeREPL.

Every time Sublime Text is started, I have to go to tools > SublimeREPL > Python > Python, to bring out REPL. When the computer is closed and opened again, the session is dead, it needs to be restarted.

A dead session, as you can see, can be back erased with no response.

This is a repetitive task. I just want REPL and the text editor open and ready to go each time.

Right now, I am looking somewhere Sublime Text > Browse Packages > SublimeREPL (or maybe User folder?).

Does anybody have any suggestion? Thanks!

0 Likes

#2

You cannot keep a Python section alive if you close Sublime Text, because it would also close the Python interpreter together with it. Unless you python interpreter is running in some server which the REPL package can connect, then you can keep the section alive. You could search whether REPL can connect a to a server, then see whether it can reconnect to the server every time Sublime Text starts.

Perhaps would also be good for you, just to REPL package to start a new section when Sublime Text is started, thought I am not a daily user of REPL package, I do not know whether the package can currently do such things. You can look into their GitHub issue tracker and open a issue for it. If it does not exists yet:

  1. https://github.com/wuub/SublimeREPL/issues

You can also be the one who implements it for us. It depends on how much do you actually need this feature, you can wait, or do it yourself and share with others.

0 Likes

#3

I don’t know how to implement a package. How do Atom, Spyder, and PyCharm do it?

Atom, I know in particular, installs a package, say terminal package, and boots up at startup. You are able to run right away.

0 Likes

#4

They seem to have built-in Support for terminal console. Are you on Linux? Perhaps the package TerminalView - Terminal inside ST3 view (Linux/macOS only) can help you. Also see the thread: TerminalView - Terminal inside ST3 view (Linux/macOS only)

0 Likes

#5

I created a keyboard shortcut to start REPL every time.

  { "keys": ["f8"], "command": "repl_open", 
              "caption": "Python",
              "mnemonic": "p",
              "args":{
                "cmd": ["python", "-i", "-u"], 
                "cwd": "$file_path", "encoding": "utf8", 
                "extend_env": {"PYTHONIOENCODING": "utf-8"}, 
                "external_id": "python", 
                "syntax": "Packages/Python/Python.tmLanguage", 
                "type": "subprocess"}
              }

Reference: Python Interactive Interpreter

Two questions on Key Binding and echo:

1) When running Python line by line in editor. How to move cursor to next line after evaluating current line [“cmd+enter”]?

//This is a macro for evaluate and move down
[
{“command”: “repl_transfer_current”, “args”: {“scope”: “lines”}}
// {“command”: “move”, “args”: {“mode”: “lines”, “amount”: 1}}
]

If this is the solution, where do I put the script?

Reference: https://stackoverflow.com/questions/44578315/making-a-sublime-text-3-macro-to-evaluate-a-line-and-then-move-the-cursor-to-the

2) How to echo line 5 and line 6 inside REPL? Line 5 echoed on the same line.

Thank you very much, I apologize for so many things in one reply.

0 Likes