rust-playground
rust-playground copied to clipboard
Add shortcut to run rustfmt
I think it would be nice if one could run rustfmt from a keyboard shortcut, similar to ctrl+return to run code, or ctrl+F9 on compiler-explorer.org.
This was something we had discussed a long while ago, and I'm generally in favor. Some thoughts:
- We should do it for all the tools
- We should show the shortcuts in the tools menu:

- We should be able to use these shortcuts both when the cursor is and is not focused on the editor component.
- We should think about making them comfortable for both macOS vs Linux/Windows users.
Another nice-to-have that's related to this would be vim-mode shortcuts for the same actions. For most of them perhaps just a command like :expand-macros or something would work, but for formatting it might also be nice to set vim's formatprg if possible, so that gq would invoke rustfmt as well (not sure if this is possible with codemirror, it might require a bit of extra plumbing or not really be worth it). Similar could be = and equalprg although which to use seems like a personal preference.