Create a gist now

Instantly share code, notes, and snippets.

@wislon /keymap.cson
Last active Jan 31, 2017

What would you like to do?
Atom key bindings for numeric keypad
# some additional keybindings that let you use the keypad as arrows (old-school)
'.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'

avish commented Jul 14, 2014

This is super useful! Just what I needed.

I think you have a mistake in lines #26-27 though, which should be bound to core:select-page-up and core:select-page-down respectively. Also, line #18 should probably be followed by 'ctrl-num-insert': 'core:copy'.

Thanks for sharing this!

Owner

wislon commented Jul 14, 2014

My pleasure! 😄

Here's yesterday's blog post that went with it: http://blog.wislon.io/posts/atom-editor-bind-number-keypad/

Owner

wislon commented Jul 15, 2014

...and fixes/changes made, well spotted! thank you :)

My hero! Thanks! Glad to see that I'm not the only CUA dinosaur around. Although, because my new job is forcing me onto a macbook, I bought a Logitech K750 wireless keyboard to get the number pad back (not interested in a disjointed number pad either). Macs, however, don't support navigation on the number pad (no numlock off) -- well, they don't anymore anyway. Furthermore, Logitech did not see fit to apply their keymapping features to this particular keyboard -- meaning, I cannot remap the numbers to navigators at the driver level (ack!!!). Thus, I've had to resort to third party software for this. SimpleKeys ($15) failed to perform well (it only triggers on the keyup event) which leaves Keyboard Maestro ($36!).

Anyhow, what all this jibber jabber means is that because I'm mapping the keypad to non-keypad keys, I guess I don't need these bindings... for now. I expect, however, I might still look into adapting them to this Mac keyboard to see if I get better Shift+Keypad-0+hold (repeat insert) performance than I get with Maestro. Then, maybe, tell Maestro to remap for everything except Atom. Oh yes, I also switched the Cmd and Ctrl keys in the Mac system settings.

Nevermind, I just checked Atom and I can't map the keypad on the Mac regardless. Atom sees the 1 on the keypad the same as the 1 on the keyboard. Thus, I'm stuck with Maestro mapping for now since it can tell the difference.

Just thought I would warn those who care what one might be in for on a Mac.

Oh yeah, what about ctrl-num-left and ctrl-num-right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment