GitHub Atom Editor numeric keypad bindings
I downloaded and installed the ‘new’ Atom editor from GitHub (the Windows version). It’s pretty clear they’ve got their initial inspiration from Sublime Text (a really great editor by the way, if you’re using the unregistered version, you really should buy it). Sublime has got a really good thing going for it, and they do say that imitation is the sincerest form of flattery. If I could just find a package for it that did proper CSS class name completion, I could ditch some of the other stuff I have to use for website development (Visual Studio, I am looking at you). But this isn’t a post about comparing editors, there’s too many of those already.
One thing the Atom guys and gals seem to have forgotten is some keyboard bindings for the secondary keys on the numeric keypad. I’m old school. I grew up with keyboards that didn’t have a specific set of arrow keys between the numeric keypad and the rest of the keys. You probably think I’m a dinosaur for saying so, but i never fully grokked those miniature arrow keys. I have big hands, so it really annoys me when I have to footle about with the tips of my fingers on inadequately-spaced tiny keys which are too close together, each one smaller than a postage stamp. So I use the numeric keypad, with the num-lock turned off.
It also means I got used to being able to use stuff like ctrl+shift+end
to quickly select everything to the end of a document, without having to pick my hand up from the aforementioned dinky arrow keys, to move them to an equally dinky set of keys just above them, to do the same. Click-and-drool programmers, and some Gen-Y folk may scoff at me for doing so, but be that as it may, everything I need is right there on the numeric keypad.
So the first thing I noticed when I opened Atom was that I couldn’t navigate through the editor at all. No up, no down, nothing. Because I was using the keypad. Rinky-dinky arrow keys worked fine. I thought that was rather silly. So I did a bit of poking around, found the Atom settings, and noticed that nothing was mapped to the secondary keys on the numeric keypad. I’m lazy. And I thought that someone on the Internet had probably done this already, since it’s a big bathroom wall of code. Maybe there was somewhere I could copy and paste from? Nope.
Really?
Nope. Or at least Google doesn’t seem to think so. Nor does the Atom forum (though there’s a few people asking for them).
So I made my own, which map to the standard, expected Windows functionality. Here they are.
*Simply copy and paste them into your keymap.cson file (accessible from **File |
Settings | Keybindings*, where it says “You can override these keybindings by copying and pasting them into your keymap file”) |
'.editor':
'num-left': 'core:move-left'
'num-right': 'core:move-right'
'num-up': 'core:move-up'
'num-down': 'core:move-down'
'num-end' : 'editor:move-to-end-of-screen-line'
'num-home' : 'editor:move-to-first-character-of-line'
'num-pageup': 'core:page-up'
'num-pagedown': 'core:page-down'
'num-delete': 'core:delete'
'ctrl-num-home': 'core:move-to-top'
'ctrl-num-end': 'core:move-to-bottom'
'shift-num-delete': 'core:cut'
'shift-num-insert': 'core:paste'
'ctrl-num-insert': 'core:copy'
'shift-num-left': 'core:select-left'
'shift-num-right': 'core:select-right'
'shift-num-up': 'core:select-up'
'shift-num-down': 'core:select-down'
'shift-num-end' : 'editor:select-to-end-of-line'
'shift-num-home' : 'editor:select-to-first-character-of-line'
'shift-num-pageup': 'core:select-page-up'
'shift-num-pagedown': 'core:select-page-down'
'ctrl-shift-num-left': 'editor:select-to-beginning-of-word'
'ctrl-shift-num-right': 'editor:select-to-end-of-word'
'ctrl-shift-num-end': 'core:select-to-bottom'
'ctrl-shift-num-home': 'core:select-to-top'
There’s also a handy GitHub gist for it, which I may or may not keep updated depending on my personal requirements.
I had to do a bit of fiddling to figure out what was ‘core’ and what was ‘editor’. But with a combination of ctrl+.
(that’s holding down ctrl
and pressing the .
key) which shows you which keys Atom thinks you’re pressing, and digging through the other key bindings, I made it work.
They take effect immediately, once you save they keybindings.cson
file with ctrl+s
.
Atom is a good editor, but it’s not great. Not yet. It’s slow to start up. Really slow. But that’s not really a deal-breaker if you have it open all the time. There doesn’t appear to be a way to refresh the folder tree view without reopening the folder, and it does strange things to other windows when you alt-tab
to them. But it has a really neat live markdown preview window which you can toggle on and off, and it can interact with your git repo, and GitHub out of the box, which is awesome.