Page 1 of 1

vim syntax highlighting missing some f'ns

Posted: 17 May 2015, 18:54
by BunsenH
Hi, all.

I've noticed that the AHK syntax-highlighting definition file that's bundled with the current version of vim fails to highlight a number of commands. The problem appears to be that although the following lines are in the "syn keyword autohotkeyPreProc" section, they aren't in the "syn keyword autohotkeyCommand" section. The exception is the "KeyHistory" item, which is in both sections and which does highlight correctly.

\ HotkeyInterval HotKeyModifierTimeout
\ Hotstring
\ IfWinActive IfWinNotActive IfWinExist IfWinNotExist
\ MaxHotkeysPerInterval MaxThreads MaxThreadsBuffer MaxThreadsPerHotkey
\ UseHook InstallKeybdHook InstallMouseHook
\ KeyHistory
\ NoTrayIcon SingleInstance
\ WinActivateForce
\ AllowSameLineComments
\ ClipboardTimeout
\ CommentFlag
\ ErrorStdOut
\ EscapeChar
\ MaxMem
\ NoEnv
\ Persistent

Re: vim syntax highlighting missing some f'ns

Posted: 18 May 2015, 12:14
by guest3456
Um, thats because they are not commands, they are preprocessed directives, requiring the # character to precede them.

KeyHistory is special because it is both a command and a directive, thats why its in both locations.

Everything highlights correctly for me:

Image

Re: vim syntax highlighting missing some f'ns

Posted: 18 May 2015, 12:22
by BunsenH
guest3456 wrote:Um, thats because they are not commands, they are preprocessed directives, requiring the # character to precede them.

KeyHistory is special because it is both a command and a directive, thats why its in both locations.
IfWinActive, IfWinNotActive, IfWinExist, and IfWinNotExist are functions. I noticed that they weren't being highlighted in code that I'd written. I wasn't paying close enough attention to notice that the other items are preprocessed directives when I wrote my note; I just saw that they also weren't being highlighted when I copied them into a test script.

Re: vim syntax highlighting missing some f'ns

Posted: 18 May 2015, 12:25
by guest3456
BunsenH wrote: IfWinActive, IfWinNotActive, IfWinExist, and IfWinNotExist are functions. I noticed that they weren't being highlighted in code that I'd written. I wasn't paying close enough attention to notice that the other items are preprocessed directives when I wrote my note; I just saw that they also weren't being highlighted when I copied them into a test script.
Those 4 are not functions (the functions are WinExist() and WinActive() and are listed under syn keyword autothotkeyFunction section), but yes they are commands.

You are right, they are similar to KeyHistory in that they are both preprocessed directives AND commands.

Re: vim syntax highlighting missing some f'ns

Posted: 18 May 2015, 21:12
by BunsenH
Commands, then. My point is that they aren't highlighted by the definition file that's bundled with the current version of vim, when they're used as commands.

Re: vim syntax highlighting missing some f'ns

Posted: 16 Feb 2017, 09:49
by guest3456
I have updated the Vim syntax file and i am maintaining it here:
https://github.com/mmikeww/autohotkey.vim

its also now included with the latest Vim