|
I am trying to set up a syntaxfile, with a.o. following lines
... syntax keyword ahkKeyName RCtrl syntax keyword ahkKeyName RShift syntax keyword ahkKeyName Enter syntax match ahkComment /;.*$/ syntax match ahkHotkey /^[^;]\+::/ highlight link ahkComment Comment highlight link ahkHotkey Tag highlight link ahkKeyname Type ... The file to be syntax-highlighted has a.o. following lines: ... ^#p::Run, appwiz.cpl ;;Add/remove programs dialog ^#r::Run, regedit.exe ;;Regedit + RCtrl & RShift::AltTab ;;AltTab Forward RCtrl & Enter::ShiftAltTab ;;AltTab Backward ... The start of the three first lines in this file, thus everything up to the :: is highlighted as ahkHotkey. I expected this for the first two lines. I thought that the Rctrl and Rshift words in the third line should be highlighted as ahkKeyName. But they are not, they are highlighted as ahkHotkey, up to and including the ::. Does this not conflict with usr_44.txt, line 149: 'Keywords overrule any other syntax item.'? Now on to the fourth line. Here both RCtrl and Enter are highlighted as ahkKeyname (Type thus). Why does this happen in the fourth line and not in the third? Furthermore, on the fourth line, the remainder of the characters that do belong to the ahkHotkey definition (thus the & and the ::) are not highlighted at all. I am very new to syntax definition and would like some clarification about the above, TIA, Guido. |
|
Hello Guido,
Try this: syntax keyword ahkKeyName RCtrl syntax keyword ahkKeyName RShift syntax keyword ahkKeyName Enter syntax match ahkComment /;.*/ syntax match ahkHotkey /[^;]*::/ contains=ahkKeyName highlight link ahkComment Comment highlight link ahkHotkey Tag highlight link ahkKeyname Type I think it will work the way You want. See :h syn-contains And I can hardly explain why /^[^;]\+::/ doesn't work the way we think it have to. Monday, June 13, 2005, 12:26:45 AM, you wrote: GVH> I am trying to set up a syntaxfile, with a.o. following lines GVH> ... GVH> syntax keyword ahkKeyName RCtrl GVH> syntax keyword ahkKeyName RShift GVH> syntax keyword ahkKeyName Enter GVH> syntax match ahkComment /;.*$/ GVH> syntax match ahkHotkey /^[^;]\+::/ GVH> highlight link ahkComment Comment GVH> highlight link ahkHotkey Tag GVH> highlight link ahkKeyname Type GVH> ... GVH> The file to be syntax-highlighted has a.o. following lines: GVH> ... GVH> ^#p::Run, appwiz.cpl ;;Add/remove programs dialog GVH> ^#r::Run, regedit.exe ;;Regedit GVH> + RCtrl & RShift::AltTab ;;AltTab Forward GVH> RCtrl & Enter::ShiftAltTab ;;AltTab Backward GVH> ... GVH> The start of the three first lines in this file, thus everything up GVH> to the :: is highlighted as ahkHotkey. GVH> I expected this for the first two lines. GVH> I thought that the Rctrl and Rshift words in the third line should GVH> be highlighted as ahkKeyName. But they are not, they are highlighted GVH> as ahkHotkey, up to and including the ::. Does this not conflict GVH> with usr_44.txt, line 149: 'Keywords overrule any other syntax item.'? GVH> Now on to the fourth line. Here both RCtrl and Enter are highlighted GVH> as ahkKeyname (Type thus). Why does this happen in the fourth line GVH> and not in the third? GVH> Furthermore, on the fourth line, the remainder of the characters GVH> that do belong to the ahkHotkey definition (thus the & and the ::) GVH> are not highlighted at all. GVH> I am very new to syntax definition and would like some clarification GVH> about the above, GVH> TIA, GVH> Guido. -- Best regards, Wind mailto:[hidden email] |
|
Hi Wind,
> Try this: > syntax match ahkHotkey /[^;]*::/ contains=ahkKeyName Does not make a difference. In fact, ahkKeyname is now always handled properly. I can't get the '+ RCtrl & RShift::' part to be fully treated as ahkHotkey anymore. Both keynames are highlighted as ahkKeyname, always. Don't have a clue why this was different last night. I think that I did not change anything anymore. Maybe i was just too tired to see clearly. :-) The problem which is still there, and not affected by the presence/absence of the contains clause, is the non-highlighting of the '&' en '::' in the 'RCtrl & Enter::' line. Both keynames are always highlighted as ahkKeyname. But the '&' and '::' are just plain black if, and only if the line starts with a Keyname in column 1. If anything precedes this keyname, even a simple space, highlighting is OK: '&' and '::' are highlighted as per the ahkHotkey, and both keynames as ahkKeyname. This should not require an non-keyname first character to work. > highlight link ahkComment Comment > highlight link ahkHotkey Tag > highlight link ahkKeyname Type > > I think it will work the way You want. > See > :h syn-contains > > And I can hardly explain why /^[^;]\+::/ doesn't work the > way we think it have to. > > > Monday, June 13, 2005, 12:26:45 AM, you wrote: > > GVH> I am trying to set up a syntaxfile, with a.o. following lines > GVH> ... > GVH> syntax keyword ahkKeyName RCtrl > GVH> syntax keyword ahkKeyName RShift > GVH> syntax keyword ahkKeyName Enter > GVH> syntax match ahkComment /;.*$/ > GVH> syntax match ahkHotkey /^[^;]\+::/ > GVH> highlight link ahkComment Comment > GVH> highlight link ahkHotkey Tag > GVH> highlight link ahkKeyname Type > GVH> ... > > GVH> The file to be syntax-highlighted has a.o. following lines: > GVH> ... > GVH> ^#p::Run, appwiz.cpl ;;Add/remove programs dialog > GVH> ^#r::Run, regedit.exe ;;Regedit > GVH> + RCtrl & RShift::AltTab ;;AltTab Forward > GVH> RCtrl & Enter::ShiftAltTab ;;AltTab Backward > GVH> ... > > GVH> The start of the three first lines in this file, thus everything up > GVH> to the :: is highlighted as ahkHotkey. > > GVH> I expected this for the first two lines. > > GVH> I thought that the Rctrl and Rshift words in the third line should > GVH> be highlighted as ahkKeyName. But they are not, they are highlighted > GVH> as ahkHotkey, up to and including the ::. Does this not conflict > GVH> with usr_44.txt, line 149: 'Keywords overrule any other syntax item.'? > > GVH> Now on to the fourth line. Here both RCtrl and Enter are highlighted > GVH> as ahkKeyname (Type thus). Why does this happen in the fourth line > GVH> and not in the third? > > GVH> Furthermore, on the fourth line, the remainder of the characters > GVH> that do belong to the ahkHotkey definition (thus the & and the ::) > GVH> are not highlighted at all. > > GVH> I am very new to syntax definition and would like some clarification > GVH> about the above, > > GVH> TIA, > > GVH> Guido. > > > |
|
Hello Guido,
Monday, June 13, 2005, 4:56:02 PM, you wrote: GVH> Hi Wind, >> Try this: >> syntax match ahkHotkey /[^;]*::/ contains=ahkKeyName GVH> Does not make a difference. Maybe You haven't notice absens of "^" char at the start of the pattern? /[^;]*::/ != /^[^;]\+::/ ^ ^ It works for me. GVH> In fact, ahkKeyname is now always handled properly. GVH> I can't get the '+ RCtrl & RShift::' part to be fully treated as GVH> ahkHotkey anymore. Both keynames are highlighted as ahkKeyname, GVH> always. Don't have a clue why this was different last night. GVH> I think that I did not change anything anymore. Maybe i was just too GVH> tired to see clearly. :-) GVH> The problem which is still there, and not affected by the GVH> presence/absence of the contains clause, is the non-highlighting of GVH> the '&' en '::' in the 'RCtrl & Enter::' line. Both keynames are GVH> always highlighted as ahkKeyname. But the '&' and '::' are just GVH> plain black if, and only if the line starts with a Keyname in column GVH> 1. If anything precedes this keyname, even a simple space, GVH> highlighting is OK: '&' and '::' are highlighted as per the GVH> ahkHotkey, and both keynames as ahkKeyname. GVH> This should not require an non-keyname first character to work. >> highlight link ahkComment Comment >> highlight link ahkHotkey Tag >> highlight link ahkKeyname Type >> >> I think it will work the way You want. >> See >> :h syn-contains >> >> And I can hardly explain why /^[^;]\+::/ doesn't work the >> way we think it have to. >> >> >> Monday, June 13, 2005, 12:26:45 AM, you wrote: >> >> GVH> I am trying to set up a syntaxfile, with a.o. following lines >> GVH> ... >> GVH> syntax keyword ahkKeyName RCtrl >> GVH> syntax keyword ahkKeyName RShift >> GVH> syntax keyword ahkKeyName Enter >> GVH> syntax match ahkComment /;.*$/ >> GVH> syntax match ahkHotkey /^[^;]\+::/ >> GVH> highlight link ahkComment Comment >> GVH> highlight link ahkHotkey Tag >> GVH> highlight link ahkKeyname Type >> GVH> ... >> >> GVH> The file to be syntax-highlighted has a.o. following lines: >> GVH> ... >> GVH> ^#p::Run, appwiz.cpl ;;Add/remove programs dialog >> GVH> ^#r::Run, regedit.exe ;;Regedit >> GVH> + RCtrl & RShift::AltTab ;;AltTab Forward >> GVH> RCtrl & Enter::ShiftAltTab ;;AltTab Backward >> GVH> ... >> >> GVH> The start of the three first lines in this file, thus everything up >> GVH> to the :: is highlighted as ahkHotkey. >> >> GVH> I expected this for the first two lines. >> >> GVH> I thought that the Rctrl and Rshift words in the third line should >> GVH> be highlighted as ahkKeyName. But they are not, they are highlighted >> GVH> as ahkHotkey, up to and including the ::. Does this not conflict >> GVH> with usr_44.txt, line 149: 'Keywords overrule any other syntax item.'? >> >> GVH> Now on to the fourth line. Here both RCtrl and Enter are highlighted >> GVH> as ahkKeyname (Type thus). Why does this happen in the fourth line >> GVH> and not in the third? >> >> GVH> Furthermore, on the fourth line, the remainder of the characters >> GVH> that do belong to the ahkHotkey definition (thus the & and the ::) >> GVH> are not highlighted at all. >> >> GVH> I am very new to syntax definition and would like some clarification >> GVH> about the above, >> >> GVH> TIA, >> >> GVH> Guido. >> >> >> -- Best regards, Wind mailto:[hidden email] |
|
Hi Wind,
> Hello Guido, > > Monday, June 13, 2005, 4:56:02 PM, you wrote: > > GVH> Hi Wind, > >>> Try this: >>>syntax match ahkHotkey /[^;]*::/ contains=ahkKeyName > > GVH> Does not make a difference. > Maybe You haven't notice absens of "^" char at the start of the > pattern? /[^;]*::/ != /^[^;]\+::/ > ^ ^ > It works for me. No, the ^ anchor is present in my syntax file (as per my original mail). But unfortunately, it does not work for me. :version VIM - Vi IMproved 6.3 (2004 June 7, compiled Jun 7 2004 14:20:56) MS-Windows 32 bit GUI version with OLE support Compiled by Bram@KIBAALE Big version with GUI. Features included (+) or not (-): +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang +netbeans_intg +ole -osfiletype +path_extra +perl/dyn -postscript +printer +python/dyn +quickfix +rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white +tcl/dyn -tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -xfontset -xim -xterm_save +xpm_w32 system vimrc file: "$VIM\vimrc" user vimrc file: "$HOME\_vimrc" 2nd user vimrc file: "$VIM\_vimrc" user exrc file: "$HOME\_exrc" 2nd user exrc file: "$VIM\_exrc" system gvimrc file: "$VIM\gvimrc" user gvimrc file: "$HOME\_gvimrc" 2nd user gvimrc file: "$VIM\_gvimrc" system menu file: "$VIMRUNTIME\menu.vim" Compilation: cl -c /W3 /nologo -DWIN32 -D_WIN32 -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 /Ox -DNDEBUG /Zi -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_BIG Linking: link /RELEASE /nologo /subsystem:console /incremental:no /nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib libc.lib user32.lib /PDB:.\ObjC/ > > GVH> In fact, ahkKeyname is now always handled properly. > > GVH> I can't get the '+ RCtrl & RShift::' part to be fully treated as > GVH> ahkHotkey anymore. Both keynames are highlighted as ahkKeyname, > GVH> always. Don't have a clue why this was different last night. > GVH> I think that I did not change anything anymore. Maybe i was just too > GVH> tired to see clearly. :-) > > GVH> The problem which is still there, and not affected by the > GVH> presence/absence of the contains clause, is the non-highlighting of > GVH> the '&' en '::' in the 'RCtrl & Enter::' line. Both keynames are > GVH> always highlighted as ahkKeyname. But the '&' and '::' are just > GVH> plain black if, and only if the line starts with a Keyname in column > GVH> 1. If anything precedes this keyname, even a simple space, > GVH> highlighting is OK: '&' and '::' are highlighted as per the > GVH> ahkHotkey, and both keynames as ahkKeyname. > > GVH> This should not require an non-keyname first character to work. > > >>>highlight link ahkComment Comment >>>highlight link ahkHotkey Tag >>>highlight link ahkKeyname Type >>> >>> I think it will work the way You want. >>> See >>> :h syn-contains >>> >>> And I can hardly explain why /^[^;]\+::/ doesn't work the >>> way we think it have to. >>> >>> >>>Monday, June 13, 2005, 12:26:45 AM, you wrote: >>> >>>GVH> I am trying to set up a syntaxfile, with a.o. following lines >>>GVH> ... >>>GVH> syntax keyword ahkKeyName RCtrl >>>GVH> syntax keyword ahkKeyName RShift >>>GVH> syntax keyword ahkKeyName Enter >>>GVH> syntax match ahkComment /;.*$/ >>>GVH> syntax match ahkHotkey /^[^;]\+::/ >>>GVH> highlight link ahkComment Comment >>>GVH> highlight link ahkHotkey Tag >>>GVH> highlight link ahkKeyname Type >>>GVH> ... >>> >>>GVH> The file to be syntax-highlighted has a.o. following lines: >>>GVH> ... >>>GVH> ^#p::Run, appwiz.cpl ;;Add/remove programs dialog >>>GVH> ^#r::Run, regedit.exe ;;Regedit >>>GVH> + RCtrl & RShift::AltTab ;;AltTab Forward >>>GVH> RCtrl & Enter::ShiftAltTab ;;AltTab Backward >>>GVH> ... >>> >>>GVH> The start of the three first lines in this file, thus everything up >>>GVH> to the :: is highlighted as ahkHotkey. >>> >>>GVH> I expected this for the first two lines. >>> >>>GVH> I thought that the Rctrl and Rshift words in the third line should >>>GVH> be highlighted as ahkKeyName. But they are not, they are highlighted >>>GVH> as ahkHotkey, up to and including the ::. Does this not conflict >>>GVH> with usr_44.txt, line 149: 'Keywords overrule any other syntax item.'? >>> >>>GVH> Now on to the fourth line. Here both RCtrl and Enter are highlighted >>>GVH> as ahkKeyname (Type thus). Why does this happen in the fourth line >>>GVH> and not in the third? >>> >>>GVH> Furthermore, on the fourth line, the remainder of the characters >>>GVH> that do belong to the ahkHotkey definition (thus the & and the ::) >>>GVH> are not highlighted at all. >>> >>>GVH> I am very new to syntax definition and would like some clarification >>>GVH> about the above, >>> >>>GVH> TIA, >>> >>>GVH> Guido. >>> >>> >>> > > > > |
|
Hello Guido,
Let's clear this. I have completely the same version of vim as you have. I ment that it doesn't work for me wit "^" anchor, but without it it works right. Monday, June 13, 2005, 6:56:31 PM, you wrote: GVH> Hi Wind, >> Hello Guido, >> >> Monday, June 13, 2005, 4:56:02 PM, you wrote: >> >> GVH> Hi Wind, >> >>>> Try this: >>>>syntax match ahkHotkey /[^;]*::/ contains=ahkKeyName >> >> GVH> Does not make a difference. >> Maybe You haven't notice absens of "^" char at the start of the >> pattern? /[^;]*::/ != /^[^;]\+::/ >> ^ ^ >> It works for me. GVH> No, the ^ anchor is present in my syntax file (as per my original GVH> mail). But unfortunately, it does not work for me. GVH> :version GVH> VIM - Vi IMproved 6.3 (2004 June 7, compiled Jun 7 2004 14:20:56) GVH> MS-Windows 32 bit GUI version with OLE support GVH> Compiled by Bram@KIBAALE GVH> Big version with GUI. Features included (+) or not (-): GVH> +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset GVH> +cindent +clientserver +clipboard +cmdline_compl GVH> +cmdline_hist +cmdline_info +comments +cryptv +cscope GVH> +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval GVH> +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding GVH> -footer +gettext/dyn -hangul_input +iconv/dyn GVH> +insert_expand +jumplist +keymap +langmap +libcall +linebreak GVH> +lispindent +listcmds +localmap +menu +mksession GVH> +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang GVH> +netbeans_intg +ole -osfiletype +path_extra +perl/dyn GVH> -postscript +printer +python/dyn +quickfix +rightleft +ruby/dyn GVH> +scrollbind +signs +smartindent -sniff +statusline GVH> -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white GVH> +tcl/dyn -tgetent -termresponse +textobjects +title GVH> +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra GVH> +viminfo +vreplace +wildignore +wildmenu +windows GVH> +writebackup -xfontset -xim -xterm_save +xpm_w32 GVH> system vimrc file: "$VIM\vimrc" GVH> user vimrc file: "$HOME\_vimrc" GVH> 2nd user vimrc file: "$VIM\_vimrc" GVH> user exrc file: "$HOME\_exrc" GVH> 2nd user exrc file: "$VIM\_exrc" GVH> system gvimrc file: "$VIM\gvimrc" GVH> user gvimrc file: "$HOME\_gvimrc" GVH> 2nd user gvimrc file: "$VIM\_gvimrc" GVH> system menu file: "$VIMRUNTIME\menu.vim" GVH> Compilation: cl -c /W3 /nologo -DWIN32 -D_WIN32 -I. -Iproto GVH> -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DWINVER=0x0400 GVH> -D_WIN32_WINNT=0x0400 /Ox -DNDEBUG /Zi -DDYNAMIC_ICONV GVH> -DDYNAMIC_GETTEXT -DFEAT_BIG GVH> Linking: link /RELEASE /nologo /subsystem:console /incremental:no GVH> /nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib comdlg32.lib GVH> ole32.lib uuid.lib libc.lib user32.lib /PDB:.\ObjC/ >> >> GVH> In fact, ahkKeyname is now always handled properly. >> >> GVH> I can't get the '+ RCtrl & RShift::' part to be fully treated as >> GVH> ahkHotkey anymore. Both keynames are highlighted as ahkKeyname, >> GVH> always. Don't have a clue why this was different last night. >> GVH> I think that I did not change anything anymore. Maybe i was just too >> GVH> tired to see clearly. :-) >> >> GVH> The problem which is still there, and not affected by the >> GVH> presence/absence of the contains clause, is the non-highlighting of >> GVH> the '&' en '::' in the 'RCtrl & Enter::' line. Both keynames are >> GVH> always highlighted as ahkKeyname. But the '&' and '::' are just >> GVH> plain black if, and only if the line starts with a Keyname in column >> GVH> 1. If anything precedes this keyname, even a simple space, >> GVH> highlighting is OK: '&' and '::' are highlighted as per the >> GVH> ahkHotkey, and both keynames as ahkKeyname. >> >> GVH> This should not require an non-keyname first character to work. >> >> >>>>highlight link ahkComment Comment >>>>highlight link ahkHotkey Tag >>>>highlight link ahkKeyname Type >>>> >>>> I think it will work the way You want. >>>> See >>>> :h syn-contains >>>> >>>> And I can hardly explain why /^[^;]\+::/ doesn't work the >>>> way we think it have to. >>>> >>>> >>>>Monday, June 13, 2005, 12:26:45 AM, you wrote: >>>> >>>>GVH> I am trying to set up a syntaxfile, with a.o. following lines >>>>GVH> ... >>>>GVH> syntax keyword ahkKeyName RCtrl >>>>GVH> syntax keyword ahkKeyName RShift >>>>GVH> syntax keyword ahkKeyName Enter >>>>GVH> syntax match ahkComment /;.*$/ >>>>GVH> syntax match ahkHotkey /^[^;]\+::/ >>>>GVH> highlight link ahkComment Comment >>>>GVH> highlight link ahkHotkey Tag >>>>GVH> highlight link ahkKeyname Type >>>>GVH> ... >>>> >>>>GVH> The file to be syntax-highlighted has a.o. following lines: >>>>GVH> ... >>>>GVH> ^#p::Run, appwiz.cpl ;;Add/remove programs dialog >>>>GVH> ^#r::Run, regedit.exe ;;Regedit >>>>GVH> + RCtrl & RShift::AltTab ;;AltTab Forward >>>>GVH> RCtrl & Enter::ShiftAltTab ;;AltTab Backward >>>>GVH> ... >>>> >>>>GVH> The start of the three first lines in this file, thus everything up >>>>GVH> to the :: is highlighted as ahkHotkey. >>>> >>>>GVH> I expected this for the first two lines. >>>> >>>>GVH> I thought that the Rctrl and Rshift words in the third line should >>>>GVH> be highlighted as ahkKeyName. But they are not, they are highlighted >>>>GVH> as ahkHotkey, up to and including the ::. Does this not conflict >>>>GVH> with usr_44.txt, line 149: 'Keywords overrule any other syntax item.'? >>>> >>>>GVH> Now on to the fourth line. Here both RCtrl and Enter are highlighted >>>>GVH> as ahkKeyname (Type thus). Why does this happen in the fourth line >>>>GVH> and not in the third? >>>> >>>>GVH> Furthermore, on the fourth line, the remainder of the characters >>>>GVH> that do belong to the ahkHotkey definition (thus the & and the ::) >>>>GVH> are not highlighted at all. >>>> >>>>GVH> I am very new to syntax definition and would like some clarification >>>>GVH> about the above, >>>> >>>>GVH> TIA, >>>> >>>>GVH> Guido. >>>> >>>> >>>> >> >> >> >> -- Best regards, Wind mailto:[hidden email] |
| Powered by Nabble | Edit this page |
