user1234440
user1234440

Reputation: 23567

Send code to interactive python sublime text

How does one sent highlighted code from sublime text 2 editor to the interactive console started by going to view > show console in sublime text 2?

Upvotes: 4

Views: 3091

Answers (1)

Will
Will

Reputation: 11500

If you are on Sublime Text 2 for a Mac, then press 'command' + 'B' to build. If you are on Windows, then press 'Ctrl' + 'B'.

  • Make sure to save your file with a .py extension (so your system will know to build in Python)
  • Also check to make sure that your 'Tools' > 'Build System' > 'Automatic'

I hope I interpreted your question correctly. If you're trying to make an interpreter on the console, you can use 'Package Control' to install SublimeREPL (https://github.com/wuub/SublimeREPL)

Edit: Showing the key control depending on what you want (e.g. just take the selection, the line, the entire file). Screenshots are on a Windows 7 PC.

After installing SublimeREPL, go to 'EVAL in REPL', and pick your selection

Here's evaluating just one line of python code

Upvotes: 9

Related Questions