How to fold code block that use the same keyword
-
In my case it’s autohotkey. ahk v2 changes the situational hotkey syntax, now it always use
#HotifExample:
#HotIf WinActive("ahk_exe Nienix.exe") a:: { Send "{b}" } c::{ Send "{d}" } #HotIf #HotIf WinActive("ahk_exe starfield.exe") e:: { Send "{f}" } g:: { Send "{h}" } #HotIfI was trying to use redundant
{and}to fold#hotifblock but was told try not to since it may define function by accident then cause error due to the new syntaxBut the UDL seems not recognize exact same keyword as beginning and ending of code folding (link://npp-user-manual.org/docs/user-defined-language-system/#udl-configuration-tabs) (I was flagged as spam come on this is npp site lol, so plz change
linkin the link tohttps)I think of a makeshift way by define #hotif
\r\nas ending part, but the UDL seems not accept#hotif\r\n, nor#hotif`r`n, nor#hotif^r^n, nor#hotif$Is it possible to fold
#hotifblock using UDL tool?
Some old language has this problem too, for example vba but I found a different behavior of it
For this code, the default highlighting system can’t foldsuborwithSub HighlightLowerThanValues() With Selection.FormatConditions(1) .Font.Color = RGB(0, 0, 0) .Interior.Color = RGB(217, 83, 79) End With End SubBut with this code, it can fold
subandwithSub HighlightLowerThanValues() With Selection.FormatConditions(1) .Font.Color = RGB(0, 0, 0) .Interior.Color = RGB(217, 83, 79) End With End SubI checked the
langs.xmlbut it has no special settings, only keyword<Language name="vb" ext="vb vbs" commentLine="'" commentStart="" commentEnd=""> <Keywords name="instre1">addhandler addressof alias ... until where yield</Keywords>Is this behavior hard coded in npp? Can it be done with UDL?
-
@byzod You can add
EndHotIfto the Close section of Folding in comment style, then comment the closing tag:#HotIf WinActive("ahk_exe Nienix.exe") a:: { Send "{b}" } c::{ Send "{d}" } #HotIf ; EndHotIf