Sublime Forum

Remapping all Sublime keys including default

#1

This is slightly related to this post.
Due to there being about 50% less keybindings available in Windows compared to Linux (in Linux there’s the super key and alt gr is also a different key and not just ctrl+alt), I’m thinking about doing a total keyboard remap for Sublime in Windows.

I’m guessing I’ll have to set all the default keys to noop first ? I’d imagine I’ve got a massive amount of conceptual organisation to carry out first, get all the keybindings, default and otherwise, ‘together’ and then think about their use.

There’s a few function keys that aren’t used and then almost all commands will have to be a two major key presses (as opposed to one key eg [ctrl+c], [ctrl+v], [ctrl+u], [ctrl+c] might become [ctrl+e, ctrl+c] (e for editor) and [ctrl+v] ==> [ctrl+e, ctrl+v])

And then (once I’m organised) it’s just a case of redoing all the user keybindings…

Has anyone else attempted this ? Any thoughts on methodology/problems I might run into? I’m figuring this will be a 1 to 2 of days work.

Am I thinking about this completely incorrectly and if so why?

Any thoughts much appreciated.

:rabbit::hocho:

Ps Lots of my keys are scoped/contexted

0 Likes

#2

Here’s a partial answer, which largely includes the mistakes that I have made during this process. The keyboard remap has taken me roughly 2 days, and I’m probably going to have to have another go, because I’ve realised a major flaw in my methodology.

Hopefully some of this will be useful to anyone else who has to go through this process, ie starts using ST on Linux and then one day moves over to Windows and finds that there are less modifier keys, don’t make the mistakes I made !

Job:

  1. Went through all the default key bindings to see if there were any keys spare.
  2. Then went through all my key bindings using the super key (there was about 80 ish) and ‘collected’ them into rough categories, which turned out to be for me (E)ditor, (F)ile, (C)omment/Code, (G)it, (I)nsert, (N)avigation and (X)tra.
  3. Nooped those keys (maybe unneccassary) eg:
  { "keys": ["ctrl+x"], "command": "noop" }

Here’s possibly my largest mistake, I thought I’ve really only got ctrl,shift and alt to use. From the initial keypress there’s only ctrl and alt. (Shift + a letter just gives a capital letter!). So I thought I’ll re-map using ctrl E,F,C,G,I,N,X and a secondary (or tertiary) keypress and remap the original keys to the new sub group.

For example:
Original Use Ctrl+e: I don’t really use that key combo, so I can ‘loose’ that key to the new system.

Original Use Crtl+c: Copy -> becomes the Comment/Code master key so it (Ctrl+c) gets remapped to Editor Copy, Ctrl+e, Ctrl+c

Original Use Ctrl+x: Cut -> becomes the Xtra master key so it gets remapped to Editor Cut, Ctrl+e,Ctrl+x

New Use Ctrl+x, Ctrl (+ Shift/Alt) (ie other key combination) handles hide error messages after build (Ctrl+x,Ctrl+h) or

{"keys": ["ctrl+x","shift+ctrl+m"], "command": "toggle_minimap"},
{"keys": ["ctrl+x","ctrl+tab"], "command": "focus_exec_panel"},

Ctrl+c now includes:

{ "keys": ["ctrl+c", "ctrl+m", "ctrl+c"], "command": "run_macro_file", "args": {"file": "res://Packages/User/moveComment.sublime-macro"} },
{ "keys": ["ctrl+c", "ctrl+d", "ctrl+c"], "command": "run_macro_file", "args": {"file": "res://Packages/User/deleteNextCommentSymbol.sublime-macro"} },

The Mistake, put most simply, is don’t use the ctrl key as the first key press, use the alt key. I haven’t checked but there maybe more default alt keys free for a start.
Key presses like Ctrl+c,x (Copy Cut) and Ctrl+f (for Find) (which is now Ctrl+e,Ctrl+f) are really deeply ingrained and using the new keybindings for only ST where the rest of everything uses the afore mentioned keys is (as we say in my part of the world) a total Nalls (a bit crap).
Plus I forgot about Ctrl+n (and other keys) for had to remap them (Ctrl+f,Ctrl+n)

If you’ve got this far:

  1. Reassign all the keys.
  2. Weep (Gratitude/Shame).

Some good has come of all this, I’ve gone through and re-organised my User Keymap (for windows) (my Linux one is still a mess) and re-familiarised myself with some keybindings, made some better, added context, etc.

My advice, if you can do it right first time, do.

If anyone’s got anything to add (other than I’m an m*ron, which hey fair enough) maybe we can save a few folks some pain…

This evening’s job is to remap using the alt key and not ctrl :crazy_face:

:rabbit::hocho:

0 Likes

#3

Something else I forgot, in part 2 as it were, changing the Ctrl keys to Alt keys.
Having checked the default keybindings noticed there were quite a few Alt keys spare, but forgot File, Edit, Selection,Find, View, Goto etc at the top, which all take Alt keys.

Something else to watch out for…:scream:

0 Likes