Output errors to Vim's quickfix window?

Discuss features, issues, about Editors for AHK
User avatar
duppy
Posts: 3
Joined: 30 Oct 2015, 21:26

Output errors to Vim's quickfix window?

Post by duppy » 05 Mar 2017, 15:52

Anyone know how to get AutoHotkey to output errors to Vim's quickfix window? I kind of got it working by setting makeprg...

Code: Select all

setlocal makeprg=autohotkey\ /ErrorStdOut\ %:p:S
This works as expected when there is an error, but when there are no errors, Vim just "hangs" there with a console window open, waiting for the script to exit. Problem is, I don't want my AHK script to exit since it has hotkeys and stuff.

I also tried the following with similar results as above:

Code: Select all

:cexpr system("autohotkey /ErrorStdOut " . shellescape(expand("%:p")))
Currently I'm running scripts with:

Code: Select all

:silent !start autohotkey %:p:S
...which works great, but it opens a GUI dialog box and shows the errors. I thought maybe I could add /ErrorStdOut and redirect stdout to a file that's later opened by quickfix (with :cfile), but that doesn't seem to work with :!start

Any ideas?
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: Output errors to Vim's quickfix window?

Post by guest3456 » 05 Mar 2017, 19:01

duppy wrote:Anyone know how to get AutoHotkey to output errors to Vim's quickfix window?
Can you post an example of an AHK script with an 'error' that you want to see?

duppy wrote: Currently I'm running scripts with:

Code: Select all

:silent !start autohotkey %:p:S
That doesn't work for me, I get command not found. I use this in my vimrc:

Code: Select all

nnoremap <F5> :!start cmd.exe /c "%:p"<CR><CR>

User avatar
duppy
Posts: 3
Joined: 30 Oct 2015, 21:26

Re: Output errors to Vim's quickfix window?

Post by duppy » 05 Mar 2017, 19:44

guest3456 wrote:Can you post an example of an AHK script with an 'error' that you want to see?

Code: Select all

#SingleInstance force
#IfWinActive ahk_class Notepad
THIS IS AN ERROR
::btw::by the way

; Win-X
#x::Send, testing 123
#IfWinActive
It should give an error about an unrecognized action on line 3.
guest3456 wrote:
duppy wrote:Currently I'm running scripts with:

Code: Select all

:silent !start autohotkey %:p:S
That doesn't work for me, I get command not found.
You would need to add AutoHotkey's folder to your PATH environment variable...or change it to something like:

Code: Select all

:silent !start c:/program files/autohotkey %:p:S
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: Output errors to Vim's quickfix window?

Post by guest3456 » 05 Mar 2017, 20:29

I don't really know, but you can check this page for some ideas:

http://vim.wikia.com/wiki/Execute_exter ... er_Windows

Let us know if you get it working

Post Reply

Return to “Editors”