Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the console in Sublime Text 3

There is Hide/Show console option in "View" menu of Sublime Text 3. I tried shell, Python and Ruby commands in it but it always returns an error.

What is this console used for?

like image 534
Saleem Avatar asked Sep 05 '25 03:09

Saleem


1 Answers

The Unofficial Documentation (which I prefer to the official documentation) states in the "Basic Concepts" section:

Sublime Text exposes its internals via an Application Programming Interface (API) that programmers can interact with using the Python programming language.

It uses an internal Python interpreter which is not the one in your system's PYTHONPATH variable. So, basic Python commands should be possible for you as it is working for me. The console output is:

...
   skipping some console output before
...
plugins-loaded
>>> x = 1
>>> y = 2
>>> f = x * y
>>> print(f)
2

The purpose of the console is to interact with an API to control Sublime Text 3 internal settings:

>>> sublime.version()
'3211'

or:

>>> sublime.message_dialog("test")

which opens a clickable dialog with the text "test".

See the API reference for more information.

like image 103
gehbiszumeis Avatar answered Sep 07 '25 23:09

gehbiszumeis