I use AHK to autoconvert a string like ]dd to the current date (see code below). When using this in most Windows text editors/areas, it works fine. But when I'm using gvim for Windows or vim in Ubuntu on WSL, I often have to type a "priming" character or try the hotstring a couple times for it to work. Searching the forum didn't return any hits on this particular issue.
#NoEnv ; Recommended for performance and compatibility with future
AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; This allows me to quickly enter date and time stamps.
::]dd::
FormatTime, TimeString, , yyMMdd ; LongDate
Send, %TimeString%
Return
:*:]t::
FormatTime, TimeString, , HHmm
Send, %TimeString%
Return
:*:]dt::
FormatTime, TimeString, , yyMMdd HHmm
Send, %TimeString%
Return
These work practically flawlessly in Notepad or other modeless text editors/areas I've used, but I really enjoy vim.
I'm guessing AHK is keying off of the space character and not CR/LF, so entering insert mode in a vim-mode editor (including the likes of PyCharm using the IdeaVim plugin) and hitting Enter doesn't let AHK know to start looking for muh hawtstrangs. I have to hit Space, and sometimes hit it a few times, to get the hotstring to be recognized.
I suppose I could just create hotkeys instead but I use this approach in Keyboard Maestro on macOS and keyboard settings in *NIXes and I value the muscle memory.
Is there a configuration somewhere that I'm overlooking, or is this just an edge case?