racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
452 stars 94 forks source link

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

Open plane opened 3 years ago

plane commented 3 years ago

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!

rfindler commented 3 years ago

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.

plane commented 3 years ago

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.

rfindler commented 3 years ago

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).

plane commented 3 years ago

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.

sorawee commented 3 years ago

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

spdegabrielle commented 3 years ago

Does collapsed text trigger the multimedia file format ?

shhyou commented 3 years ago

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.

spdegabrielle commented 2 years ago

@spdegabrielle This feature should be possible with quickscript