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
#Hotif
Example:
#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}" } #HotIf
I was trying to use redundant
{
and}
to fold#hotif
block 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
link
in the link tohttps
)I think of a makeshift way by define #hotif
\r\n
as 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
#hotif
block 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 foldsub
orwith
Sub HighlightLowerThanValues() With Selection.FormatConditions(1) .Font.Color = RGB(0, 0, 0) .Interior.Color = RGB(217, 83, 79) End With End Sub
But with this code, it can fold
sub
andwith
Sub HighlightLowerThanValues() With Selection.FormatConditions(1) .Font.Color = RGB(0, 0, 0) .Interior.Color = RGB(217, 83, 79) End With End Sub
I checked the
langs.xml
but 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
EndHotIf
to 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