sublimetext3 - How to change the Sublime Text 3 StatusBar message in a command or macro (no plugin)? -
addressing sublime text 3 users here.
i wrote couple of macros enable spell-check , load specific dictionary, swap between french , english , wanted simple shortcut (instead of browsing menu or 2 successive commands in command pallet).
my macros work expected (french-spellcheck.sublime-macro, english-spellcheck.sublime-macro). display message in status bar, instance "switched french" or "switched english" (for time, let 5 sec).
i looked everywhere know , tried time, apparently there no way in command (that added @ end of macro), set_status
internal st3's python api command (from window
package) available plugins...
does 1 has idea of how display message sublimetext3 statusbar in command/macro , not plugin? thanks!
there no built in command invokes api methods doing (at least not documented one), there's no way go without plugin of sort.
that said, in order want, following need save file named e.g. set_status.py
in packages/user
folder (alongside macros). provides set_status
command takes value named value
text display, mentioned in commented out portion of macro file.
import sublime, sublime_plugin class setstatuscommand(sublime_plugin.textcommand): def run(self, edit, value="set_status: use arg 'value' set text"): self.view.window ().status_message (value)
this uses different api 1 mention in macro file comments; status_message
work of displaying message in status bar, waiting few seconds, , removing it, makes command simple implement.
if wanted more control (i.e. change duration) need modify invoke api commands macro files mention: view.set_status()
, sublime.set_timeout()
.
Comments
Post a Comment