How to execute ahk (AutoHotScripts) scripts using gVim?

Let say I have interpreter:

"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "d:\ahk\myscript.ahk" 2>"Syntax-Error Log.txt"

While I am in normal mode in gVim I press leader s. Screen divides into two windows. New window with Error Stream shows at the bottom. Similar to every IDE behaviour when you run/debug program.

Window focus should stay at the window with ahk script. If everything is OK, then ahk script is executed.

  • Bit late now, but take a look at :help 30.1
    – Rich
    Commented Aug 3, 2022 at 6:41

1 Answer 1


I manage to do partial solution, but still there is problem with, nesting errorlog windows, and cmd.exe that hangs after execution.

noremap <leader>s :!"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut \ %:p 2>"errorlog.txt"<CR> :sp errorlog.txt<CR><C-W>J<CR> :resize 5<CR>

  • 1
    Try using: :!start instead of just :! to suppress the cmd.exe window.
    – Heptite
    Commented Dec 5, 2021 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.