Is it possible to delete an entry from console history? Or to have a method of selectively saving commands in history (like in bash, for example, one can setup to not remember any commands that started with space character).
Keeping console history clean-ish
AFAIK even a standard interactive python console doesn’t offer something like that because as soon as you put a space in front you get an unexpected indent error, and other chars could conflict with python syntax…
Probably the way to do it is manually edit the session/workspace file in another editor with ST closed…
Console history is not stored anywhere. The way to clear the console is to restart Sublime Text.
To simply clear the console window I use this:
import sublime_plugin, sublime
class ClearConsole(sublime_plugin.ApplicationCommand):
def run(self):
settings = sublime.load_settings("Preferences.sublime-settings")
scrollback = settings.get("console_max_history_lines")
settings.set("console_max_history_lines", 1)
print("") # noqa
settings.set("console_max_history_lines", scrollback)
Yup. I figured this was the way. Was just wondering if I missed some easier way to do it.
To other responders: Thanks.
A) You are probably talking about some other console. This one does save history – in the Session.sublime_session file. And
B) I’d like to keep some useful commands there, without a ton of wrong ones. Not clear it completely.