vim syntax highlighting missing some f'ns

Discuss features, issues, about Editors for AHK
BunsenH
Posts: 6
Joined: 11 Apr 2015, 10:45

vim syntax highlighting missing some f'ns

17 May 2015, 18:54

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
guest3456
Posts: 2086
Joined: 09 Oct 2013, 10:31

Re: vim syntax highlighting missing some f'ns

18 May 2015, 12:14

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

BunsenH
Posts: 6
Joined: 11 Apr 2015, 10:45

Re: vim syntax highlighting missing some f'ns

18 May 2015, 12:22

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.
guest3456
Posts: 2086
Joined: 09 Oct 2013, 10:31

Re: vim syntax highlighting missing some f'ns

18 May 2015, 12:25

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.

BunsenH
Posts: 6
Joined: 11 Apr 2015, 10:45

Re: vim syntax highlighting missing some f'ns

18 May 2015, 21:12

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.
guest3456
Posts: 2086
Joined: 09 Oct 2013, 10:31

Re: vim syntax highlighting missing some f'ns

16 Feb 2017, 09:49

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


Return to “Editors”

Who is online

Users browsing this forum: No registered users and 2 guests