FocusIn event, serial 37, synthetic NO, window 0x2c00001, mode NotifyGrab, detail NotifyPointer
KeymapNotify event, serial 37, synthetic NO, window 0x0, keys: 4294967188 0 2 0 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
| # { "keys": ["ctrl+whatever"], "command": "example" }, | |
| # { "keys": ["ctrl+whatever"], "command": "example_two" } | |
| import sublime, sublime_plugin | |
| # ********************* | |
| # WindowCommand Version | |
| # ********************* |
| # Proof of concept; retrieve the path of the syntax that a user has | |
| # associated with any file extension in Sublime Text. | |
| # | |
| # 1) Create a temp file with the file extension of the desired syntax. | |
| # 2) Open the temp file in ST with the API `open_file()` method; use a | |
| # sublime.TRANSIENT buffer so that no tab is shown on the tab bar. | |
| # 3) Retrieve the syntax ST has assigned to the view's settings. | |
| # 4) Close the temp file's ST buffer. | |
| # 5) Delete the temp file. | |
| # |
| # Code to test the reliability of windll.kernel32.GetFileAttributesW() | |
| # by running it on every file (that has read access) on the file system. | |
| import os, os.path, sys | |
| from ctypes import windll | |
| HIDDEN_FILE_ATTRIBUTE = 2 | |
| GET_ATTRIBUTES_FAILED = -1 |
| /* | |
| Writes a left mouse button press or release event | |
| directly to the input device of the mouse. | |
| Credit for barebones code: https://goo.gl/upXCqR | |
| Currently takes one arg which must be either of: | |
| BTN_LF_PRESS: write a left mouse button press event | |
| BTN_LF_RELEASE: write a left mouse button release event | |
| Written by: mattst@i-dig.info @ 2018-03-02 |
| # The following methods are part of a project and are not stand-alone code. As | |
| # such anyone wishing to re-use the code will have to modify it, note the use of | |
| # the class variables `self.active_window` and `self.active_view` which would | |
| # need to be changed to valid instances of the active `window` and `view`. | |
| def set_syntax(self, path): | |
| """ | |
| Sets the syntax associated with the file extension of path. | |
| There is no method to get the syntax of a file extension in the ST API. |
| # | |
| # Name: JumpToCharSeq (Jump To Character Sequence) | |
| # Requirements: Plugin for Sublime Text v.3 | |
| # Written by: mattst@i-dig.info | |
| # | |
| # ST Command: jump_to_char_seq | |
| # | |
| # Optional Arg: direction | |
| # ----------------------------------------------------------- |
| # | |
| # Name: JumpToCharSeq (Jump To Character Sequence) | |
| # Author: mattst@i-dig.info | |
| # Requires: Sublime Text v3 | |
| # | |
| # ST Command: jump_to_char_seq | |
| # Optional Arg: direction --> "forwards" (default), "backwards" | |
| # Optional Arg: case_sensitive --> boolean (default is false) | |
| # |
| # | |
| # Name: Expand Selection By Expression | |
| # Author: mattst@i-dig.info | |
| # Requires: Sublime Text v3 | |
| # | |
| # ST Command: expand_selection_by_expression | |
| # Optional Arg: expression_type --> "regex" (default), "literal" | |
| # Optional Arg: case_sensitive --> boolean (default is false) | |
| # |
| # | |
| # MIT License | |
| # | |
| # To use, assign keys to the "focus_most_recent_tab_closer" command, e.g. | |
| # {"keys": ["ctrl+k", "ctrl+w"], "command": "focus_most_recent_tab_closer"}, | |
| # | |
| import sublime | |
| import sublime_plugin | |
| import time |