heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.38k stars 45 forks source link

Change default keyboard shortcut #13

Open curtisblackwell opened 4 years ago

curtisblackwell commented 4 years ago

In apps with tabs, Command + Shift + T is usually the shortcut to re-open the most-recently-closed tab. This is also the case in VS Code (at least with the Atom keymap enabled).

A different default keyboard shortcut would be great. I'm aware I can change it, but it's still frustrating, especially for those of use who work on multiple computers. I've changed mine to Control + Option + Command + T for now.

heybourn commented 4 years ago

Any ideas as to what shortcut would be better?

curtisblackwell commented 4 years ago

I don't mind Control + Option + Command + T. Could also use a chord. Shift + Command + K chord Shift + Command + T.

Might be good to do a poll or something.

I imagine once fix on save is possible, I'll disable it altogether as I'll rarely need it. Only if I have an unsaved file I'm mucking around with, in which case I'd just use the command palette.

heybourn commented 4 years ago

Run on save is now possible, however I will look into adding a config option to change the default shortcut today.

adriaanzon commented 4 years ago

Have you considered registering as a formatter instead of a command? https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices

Then you would just be able to use the default formatter shortcut of Shift+Option+F

heybourn commented 4 years ago

Have you considered registering as a formatter instead of a command? https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices

Then you would just be able to use the default formatter shortcut of Shift+Option+F

I have, however this caused some issues last time I tried. I'm open to it (so long as it won't break anything).

adriaanzon commented 4 years ago

Thinking about it again, I actually like being able to run the sort operation separate from formatting the whole document (especially when working with Vue files which can also include JavaScript).

ctrl+shift+h might be a good default shortcut, it's what the IDEA port uses.

TimonVS commented 3 years ago

As a temporary fix, add this to your keybindings.json (cmd + shift + p > keyboard shortcuts). The keybinding will override the one from the plugin. You can probably add another keybinding for Headwind here, but I have it done automatically on save. Added it below to bind to ctrl+shift+h.

[
  {
    "key": "shift+cmd+t",
    "command": "workbench.action.reopenClosedEditor",
  },
  {
    "key": "ctrl+shift+h",
    "command": "headwind.sortTailwindClasses",
    "when": "editorTextFocus"
  }
]
Christopher-Hayes commented 2 years ago

+1 This was a pretty surprising keyboard rebinding. At least for me, CMD + SHIFT + T is a frequently used binding in both browsers and editors.