drracket icon indicating copy to clipboard operation
drracket copied to clipboard

Feature request: keybind support for "collapse s-expr" and "expand s-expr"

Open plane opened this issue 4 years ago • 8 comments

In DrRacket, you can collapse or expand s-exprs visually by right-clicking and picking "Collapse s-expression" or "Expand s-expression" (similar to what is called "folding" in some other editors). This is very nice, but it doesn't appear that there is an easy way to bind a key to collapse/expand. This would be nice to have!

plane avatar Sep 09 '21 12:09 plane

Do you know what keybindings other editors use for this? (It may be different on different platforms.)

Robby

On Thu, Sep 9, 2021 at 7:42 AM plane @.***> wrote:

In DrRacket, you can collapse or expand s-exprs visually by right-clicking and picking "Collapse s-expression" or "Expand s-expression" (similar to what is called "folding" in some other editors). This is very nice, but it doesn't appear that there is an easy way to bind a key to collapse/expand. This would be nice to have!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/racket/drracket/issues/504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADBNME3XUXCSAZ5LST2K4LUBCTUDANCNFSM5DXBQVZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rfindler avatar Sep 09 '21 12:09 rfindler

Although I don't use VS Code myself, the docs list the keybinds as Ctrl-Shift-[ to fold, Ctrl-Shift-] to unfold, and some additional keybinds hidden behind Ctrl-K. Those first two don't seem to do anything by default in DrRacket, so maybe they could be good candidates?

https://code.visualstudio.com/docs/editor/codebasics

I'm personally used to vi, where the folding keybinds all begin with z, as in zo and zc (where o and c are for "open" and "close"), but that's probably not too helpful here.

plane avatar Sep 09 '21 13:09 plane

I think that probably those are, in a generic sense, "<menu-key-modifier>-shift-[" and "<menu-key-modifier>-shift-]" which are bound to next tab and previous tab (following browser convention).

rfindler avatar Sep 09 '21 13:09 rfindler

Oops! I didn't have multiple tabs open when I tried it out. I guess those are taken.

I installed another editor called Sublime Text, and it appears that it also uses Ctrl-Shift-[ and ], again with some additional keybinds hidden behind Ctrl-K.

plane avatar Sep 09 '21 14:09 plane

In VSCode for Mac, next and previous tabs are cmd-shift-[ and cmd-shift-] respectively. Fold and unfold are alt-cmd-[ and alt-cmd-].

sorawee avatar Sep 09 '21 14:09 sorawee

Does collapsed text trigger the multimedia file format ?

spdegabrielle avatar Sep 09 '21 21:09 spdegabrielle

Does collapsed text trigger the multimedia file format ?

Both cases are possible. With the option "Ask before changing save format" in the preferences, DrRacket will ask the user whether to save the file in plain text or in the WXME format. When saving as plain text, collapsed S-expressions are simply expanded and it works just fine.

shhyou avatar Sep 10 '21 14:09 shhyou

@spdegabrielle This feature should be possible with quickscript

spdegabrielle avatar Nov 18 '21 01:11 spdegabrielle