Thanks
, But I’ll explain to you:
It’s not just some sort of eccentricity this guy here appears to display; it’s more than that. The key to that request is AutoHotkey. See, AHK is both a Windows end-user program and a fully-fledged programming language; on the user-side of AHK, one of the things it does is hotstrings: a piece of user-defined abbreviations that, when typed, they expand, like inctb
-> I need to change the title bar
. AHK, while running in the background, monitors the user input until it sees a pattern which was predefined as an abbreviation. When the sequence is typed, the program hits Backspace
the number of times equal to the lenght of the abbreviation then types the expansion for you. So upon typing “inctb”, the program will hit Backspace 5 times, then write out “I need to change the title bar”. Pretty cool, right? There are dozens of programs which do that, both free and paid. The underrated AutoHotkey is both free, open source and the most powerful.
But there is the catch: AHK doesn’t know if the user means to actually type (INSERT MODE) text, or if he’s performing a sequence of Vim commands (COMMAND MODE). So when a user defines a hotstring like this: 50x
-> Fifty times
, if Sublime is accidentally with Vim set to command mode, it will perform the disastrous “erase fifty characters ahead" command instead of typing the phrase “Fifty times”. So the performance boost the user intended to have with Vim will be neutralized by AutoHotkey’s, or vice-versa.
“OK, now I know what AHK is capable of doing but I don’t know changing the titlebar would be of any help”. Thing is, among a million other functions, AHK can watch the active window's title
, and have a hotstring or hotkey be enabled only if the active window’s title matches a predefined string. So we write our AutoHotkey script like this:
#IfWinActive, .* - Sublime Text - Insert mode
::mhs::my hotstring
#IfWinActive
The part enclosed by the "#IfWin… fences are only executed when the active window title matches that pattern (something followed by “Sublime Text” followed by “- Insert mode”.
That way, we would be able to have AutoHotkey do the hotstring expansions only if it detects that current window (Sublime Text’s) has a piece of text matching “- Insert mode”. Then we would have the best of the two worlds without a conflict.
See? It’s actually very important for people serious about productivity, which is something Sublime Text, Vim and AutoHotkey have in common. 