Jump to content

Collapse all SciTe Folds Hotkey


Recommended Posts

Does anyone know of a hotkey/way to collapse all of the syntax folding in SciTE with one fell swoop? Not really a necessity, but it'd be pretty spiffy to be able to collapse all of my syntax folds at once and not have to do a lot of clicking everytime I open some scripts. :D

Link to comment
Share on other sites

View --> Toogle all ...

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

....able to collapse all of my syntax folds at once and not have to do a lot of clicking everytime I open some scripts. :D

For the opening of scripts to be folded by default, then add this into your User Options file and save.

# Folding
# enable folding, and show lines below when collapsed.
fold=1
fold.compact=1
fold.flags=16
fold.symbols=2
fold.on.open=1
fold.comment=1
fold.preprocessor=1

These are the options that I currently use. Use Megas' method as needed while the file is open.

:D

Link to comment
Share on other sites

For the opening of scripts to be folded by default, then add this into your User Options file and save.

# Folding
# enable folding, and show lines below when collapsed.
fold=1
fold.compact=1
fold.flags=16
fold.symbols=2
fold.on.open=1
fold.comment=1
fold.preprocessor=1

These are the options that I currently use. Use Megas' method as needed while the file is open.

:D

Cool beans, thanks peeps!
Link to comment
Share on other sites

  • 2 years later...

Sorry to grave dig a 2 year old thread, but I found a "solution" to this minor annoyance.

You could just make an autoit script to "add" the hotkey.

#NoTrayIcon
HotKeySet("!`", "HowDidINotThinkOfThisSooner")
HotKeySet("!0", "_Exit")
Opt("WinTitleMatchMode", 2)
While 1
    Sleep(1000)
WEnd
Func HowDidINotThinkOfThisSooner()
    WinMenuSelectItem("SciTE", "Source", "&View", "Toggle &all folds")
EndFunc   ;==>HowDidINotThinkOfThisSooner
Func _Exit()
    Exit
EndFunc   ;==>HowDidINotThinkOfThisSooner
Link to comment
Share on other sites

  • 2 years later...

@ BitByteBit

Sorry to grave dig a 2 year old thread, but I found a "solution" to this minor annoyance.

Same here, but thanks for your post. I also have added to a 2 year old post, in hopes someone can either use this information, or clean it up and improve upon it. :)

#NoTrayIcon

HotKeySet("!`", "HowDidINotThinkOfThisSooner")
HotKeySet("!1", "_ToggleSelectedregionsInnerFolds")
HotKeySet("!0", "_Exit")

Opt("WinTitleMatchMode", 2)

While 1
Sleep(1000)
WEnd

Func HowDidINotThinkOfThisSooner()
WinMenuSelectItem("SciTE", "Source", "&View", "Toggle &all folds")
EndFunc ;==>HowDidINotThinkOfThisSooner

Func _ToggleSelectedregionsInnerFolds()
Local $FuncNotes = "; #FUNCTION#",$Look4FuncNotes = 0
$SciTEHWND = WinGetHandle("SciTE", "Source")
$Temp = WinGetTitle($SciTEHWND)
ConsoleWrite($Temp&@CRLF)
$Temp1= StringSplit($Temp," - SciTE ",3)
If @error Then Return
$SciTEtitle = $Temp1[0]
$FileOpen = FileOpen($SciTEtitle,0)
If $FileOpen = -1 Then Return
$FileRead = FileRead($FileOpen)
FileClose($FileOpen)
ClipPut("")
WinActivate($SciTEHWND)
Send("{HOME}")
Send("+{END}")
Send("^c")
$Region = ClipGet()
$Temp = StringInStr($FileRead,$Region,0)
If @error then Return
$Temp1 = StringTrimLeft($FileRead,$Temp-1)
$Temp2 = StringInStr($Temp1,"#endregion",0)
$FoundRegion = StringLeft($Temp1,$Temp2+10)
ConsoleWrite($FoundRegion&@CRLF)
$Count = 0
Do
$Temp = StringInStr($FoundRegion,"EndFunc",2,$Count+1)
If $Temp = 0 Then ExitLoop
$Count+=1
ConsoleWrite("Found End function "&$Count&" here: "&$Temp&@CRLF)
Until 1<>1
If $Count = 0 Then Return
$Look4FuncNotes = StringSplit($FoundRegion,$FuncNotes,1)
If @error then
$Look4FuncNotes = 0
Else
$Look4FuncNotes = 1
EndIf
ConsoleWrite("Found "&$Count&" Functions "&@CRLF)
WinActivate($SciTEHWND)
Send("{HOME}")
Send("{DOWN}")
WinMenuSelectItem($SciTEHWND,"","&Search","&Find")
Send("EndFunc")
Send("{ENTER}")
For $x=1 to $count
WinMenuSelectItem("SciTE", "Source", "&View", "Toggle ¤t fold")
Send("{HOME}")
Send("{UP}")
Send("{DOWN}")
Send("{DOWN}")
If $x <> $count Then Send("{F3}")
Next
If $Look4FuncNotes = 1 Then
WinActivate($SciTEHWND)
Send("^{HOME}")
WinMenuSelectItem($SciTEHWND,"","&Search","&Find")
Send("{#}"&StringTrimLeft($Region,1))
Send("{ENTER}")
Send("{HOME}")
Send("{DOWN}")
WinMenuSelectItem($SciTEHWND,"","&Search","&Find")
Send("; {#}FUNCTION{#}")
Sleep(300)
Send("{ENTER}")
Send("{HOME}")
For $x=1 to $count
WinMenuSelectItem("SciTE", "Source", "&View", "Toggle ¤t fold")
Send("{HOME}")
Send("{DOWN}")
If $x <> $count Then Send("{F3}")
Send("{HOME}")
Next
EndIf
EndFunc

Func _Exit()
Exit
EndFunc ;==>HowDidINotThinkOfThisSooner

a few caveats:

- I use regions to help sort through my code. If you use regions, put a name after the region of what that region contains. For this to work, they should all be different region names.

- Save your work before calling the hotkey. (good practice anyway), as the code will read your file to do the searching. (it will discover how many functions are contained in the region to toggle).

- Put your cursor anywhere on the desired #Region name where you want to toggle closed the below functions. Press the hotkey Alt 1

I find this very helpful, when you toggle ALL folds, and still want to drill down to a particuar function within a region. unfortunately, I don't know if there is a setting to auto fold these, so when you do the ALL, and then open a region, those functions are all expended. This utility add on will close all the folds for you only withhin the selected region.

Edited by kalel69
Link to comment
Share on other sites

  • 5 years later...

Is there a way to collapse all variables that is declared globally outside all other functions and statements? 
oh Nevermind I have it all undermynoise from the beginning  of my scripting I just didnt Realize. I just answer my question then for some other guy that might need it

#Region ### START Koda GUI section ### Form=c:\users\mk's\desktop\form1.kxf

scripts here...

#EndRegion ### END Koda GUI section ###

Edited by senatin
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...