Programmer’s Keyboard

This summer Jeff Atwood (@codinghorror) has designed and helped to release a new mechanical keyboard aimed at programmers. It was intended to be a modern replacement for the venerable, yet beloved Model-M. If you haven’t heard a Model M keyboard, it’s probably because you haven’t been in the same building as one of them – otherwise you would be intimately familiar with the thunderous clickety-clack noise these devices make. People seem to love them, and there is a big market for loud keyboards with hard to press keys so I wasn’t at all surprised at his announcement. I wasn’t all that interested in it either because I don’t really care about mechanical keyboards one way or the other.

Code Keyboard

Atwood’s CODE keyboard. It lights up! Also, still has Caps Lock key.

I’m pretty happy with my ergonomic space-alien keyboard (as my friends call it) and so I mostly ignored Atwood’s design. I was cleaning out my RSS reader the other day and stumbled on an old post in which David Bryant Copeland made fun of the design. His post isn’t as much as a critique of the keyboard as an interesting commentary on the lack of innovation on the programmer-keyboard market.

Most keyboards produced and sold in US use QWERTY layouts patterned after the 104-key ANSI standard or the 105-key ISO standard (that’s the one with the funky reverse-L shaped enter key). Standardized layouts are of course a good thing, but they are getting a little long in the tooth. The sizing and placement of the non-alphanumeric keys has very little to do with the frequency of their use. I could take a few paragraphs to point out everything that is wrong with these designs, but I don’t have to because David made a very succinct and to the point list of all their idiosyncrasies:

  • Hitting “space” is the most important thing you could ever do.
  • Caps Lock and Enter are pretty important and of equal importance – they are the second easiest keys to hit outside of the home
  • Letters are more important than numbers, as numbers are farther away from the home position.
  • Control, Alt, “Meta”/Windows, and Shift are all more important than numbers (they are an equal distance away, but have much larger keys).
  • Alt is the most important modifier – it’s right where your thumbs are, making it easy to hold down while typing other things.
  • Tab and Backslash are of equal importance, and are more important than most keys.
  • Print Screen, Scroll Lock, Pause, Home, End, Page Up, Page Down, Insert, Delete and the arrow keys are all of equal importance,
    but lesser than the alphanumerics and modifiers as they are set off to the right.
  • Analphabetics like “!”, “%”, and “{” are least important, because they require the shift key to enter. “+” and “~” are probably
    the least relevant of these, because they are the most difficult to type: you must use Shift and your pinky, and you have to stretch for them.

Personally, I have never used the Caps Lock key in my life, and the only time I ever touch the left Alt key is to alt-tab out of video games (well, ones that support it)… I won’t even mention the “windows” key, aka “instant death button” (whenever you press it by accident in a video game, you are almost guaranteed to be dead by the time you get back in). In fact, we had a whole thread about useless keyboard keys not so long ago.

The standard ANSI and ISO layouts are not optimal designs. They don’t work all that well for writing prose, but they are especially horrible for programmers. The useless keys are up in your face, whereas common programming symbols are inaccessible without modifiers. David’s post got me thinking about how one would go about designing something more suited for day to day coding.

There haven’t been a ton of innovations in the world of text entry over the years (at least not for writing prose or code – it’s all been focused on text message). There’s a smattering of “ergonomic” keyboards some of which provide more “thumb keys”, but in general, this is the same keyboard that’s existed for the majority of our lives. Even alternate layouts like Dvorak keep most things they same – they just shuffle around the letters.

How would you design a better keyboard? Lets use a standard ANSI keyboard as our starting point:


Standard ANSI Layout

I actually prefer ANSI over ISO one because Enter and Caps Lock are approximately the same size. Being a Vim user I typically re-map the latter to Esc which gives the keyboard a nice symmetrical feeling. In vim the you hit the Escape key about as frequently as the Enter key so this works out very well. Similarly the \ key being disproportionately large is not necessarily a bad thing because it is your default “leader” key. It works as a magic button you use to preface user defined command sequences. If you are a moderate to advanced user you will probably be hitting that key all the time.

I took the liberty of vimifying the very basic ANSI setup above without making any other drastic changes and it already is a big improvement. I made the command keys yellow, HJKL block green and made Esc, \ and : keys stand out because of their importance:

Basic Vim

Basic Vim Layout

This is something you could do to just about any basic keyboard using nothing but custom key-caps and some re-mapping tools. But let’s take this a little bit further.

The leader key is easy to hit because of it’s size, but most vim users find that extending your pinking all the way to the right is not optimal. When you look through the hundreds of .vimrc files on Github you will notice that remapping leader key to , is a very common practice. That’s because the comma is just off the home row, and thus much more accessible. What if we could move the leader key under your thumb?

The Alt key has some uses in vim, but it is a far less common modifier than Control or Shift. The Windows/Meta key has no uses whatsoever, so why not push the entire block to the left. Control stays on the outside, then Alt and our new leader key lands in the super-privileged position right next to the space bar. Does that make sense? What would you put in that spot.

Since we moved the leader we are still left with a fairly large key under the backspace. What should we do with it? I’m not entirely sure. I’d be tempted to split it into two if possible. But if not, how about we keep it as the pipe | key. I frequently program in ruby, so this makes perfect sense to me. Ruby blocks are enclosed in double bars and for some reason I’m always kinda annoyed I need to hit Shift to type them.

Speaking of shift, do people actually use right one? And by that I mean the one on the right side of the keyboard. I know how they are supposed to work, but for some reason in my mind shifting is exclusively a left-hand task. This might actually be a deep flaw in my touch typing technique, but whatever. I don’t feel particularly attached to the right shift key, and it is super huge. It is big enough to be replaced by two keys. Like ( and ) for example.

Most programming languages use parenthesis everywhere: scoping, function declarations, order of operations, etc.. Why not give them dedicated keys? We can still have them as modified alternate values on 9 and 0 but it seems like they should be first class citizens on a programmer-centric keyboard.

Maybe my hands are weird, but when my fingers are on the home row, there seems to be no good way to hit anything beyond the right Alt without executing some sort of weird finger contortion. The keys there are of the absolutely useless variety, but replacing them with anything seems pointless. So you know what? Fuck those keys. They are gone.

Finally, while Backspace has some utility in inser mode, it is not nearly as important in vim. It certainly does it need to be the same size as Enter. Personally I think it should be the size of a regular, average key. it’s position on the extreme upper right edge of the keyboard already makes it an easy target. So that gives us an extra key we could squeeze in after the =. What should go there?

I figured that macros are a big part of vim usage, but running them is always a pain. The @ is both out of the way, and requires you to hold shift to access it. Why not give it a dedicated key to the left of backspace.

The updated layout would look something like this:

Advanced Vim

Crazier Vim Based Layout

Most of these changes are very superficial, and in a large part vim-centric. While I moved a number of keys around the overall shape is still very much classic ANSI with just a few additions and removals. Could we do better than this?

Let’s forget about vim for a minute and design something generic. What button do you non-vimers press as frequently as I press Esc? It’s hard to say, but I would venture a guess that it is Ctrl. That’s where most editors hide all the special functions and macros, isn’t it? So let’s put it where Caps Lock used to be. This way it is just off the home row, and under your left pinky at all times.

I mentioned it before, but since the space bar is pretty much the focal point of the keyboard, the spots immediately to the left and right of it are prime real estate that is completely wasted on the underused Alt key. Apple knows this quite well, which is why they put their Cmd key in that very spot. What should a programmer keyboard have in that spot?

Why not shift? Shift keys are already in pretty good locations but that’s mostly due to their size. If we put them underneath your thumbs, we can shrink them down to regular-key size, without making them harder to hit. This gives us two to three additional keys on each side of the keyboard. Also since we moved Ctrl and we don’t want Windows/Meta we can easily fit another two keys on the bottom left.

That gives us 6-7 spare keys. What could we do with all of those? Let’s think about symbols programmers type very frequently?

  • I already mentioned parenthesis. They should have keys of their own.
  • Curly braces are another good candidate. Most programing languages use them for scoping, and yet they have to be shifted. Strangely enough square braces are typically only used for arrays/collections. This seems backwards. Perhaps we should just switch these around.
  • The + symbol is used all the time for math, and most languages overload it for other things like string concatenation. And yet it is one of the most difficult keys to type. Not only is it far from the home row, but also needs a shift modifier.
  • Many languages standardize on snake_case for variable and function names, but the underscore is just as hard to type as the plus sign.
  • If you happen to work with HTML a lot, shifting to type < and > can be super tedious.
  • PHP, Perl, Powershell (and probably bunch of other programming languages that start with P) like to preface variable names with $ symbol which is both far away from the home row, and requires a shift.
  • The @ is also a common symbol (Perl uses it for array, Python for decorators and etc..)

Let’s try to arrange it on our mock keyboard:

Generic Programmers Keyboard

A generic keyboard layout for programmers.

You have your angle brackets on the left, and parenthesis on the right. The + sign and the underscore are on the extreme bottom left. The curly and square braces were flipped so that you don’t have to use the shift key to create scope. I also added the $ and @ keys above and below enter for easy access.

Note that while this layout is no longer ANSI compliant, it still more or less follows the standard. You can sit at it and start touch typing from memory without making any adjustments and you should be fine. Other than flipping curly braces upside down, I haven’t really changed placement of any keys. I merely added new/redundant ways to enter them.

In his post David suggests a few even more drastic, though probably beneficial alterations:

The symbols most-frequently needed are the exclamation mark, dash, and parenthesis. They are all ill-placed in this layout, being far away from the home keys, while more convenient locations are taken up by the rarely-needed caret, ampersand, and asterisk. I’d bump the parenthesis over one, putting the asterisk on the “0”, swap the exclamation mark with the ampersand, and finally, exchange the carat for the dash.

Let’s add these to our mock-up:

Programmer Two

Even more radical approach.

How is that for a coding keyboard? Better? Worse? Absolutely terrible?

How would you re-organize your keyboard of optimal coding layout? Note that this is not necessarily about what you are used to, but what could potentially improve your productivity as a programmer.

This entry was posted in programming. Bookmark the permalink.

16 Responses to Programmer’s Keyboard

  1. joek UNITED KINGDOM Mozilla Firefox Linux says:

    I’m not much of a programmer — I do some scripting in bash and python, but nothing serious — and as someone reading history at university, by far and away my typing is mostly writing continuous prose — although usually marked up in LaTeX rather than using a WYSIWYG editor, but, disclaimers aside, some observations:

    * When I learnt to touchtype, I taught myself to use both shift keys. When capitalising a left-of-keyboard letter, I tend to use right-shift, and vice-versa
    * I also use Alt *loads*. After e-r-t- which are the most common keys for typing in English, pretty much, Alt is probably the key I use most. Admittedly, I spend a lot of time in tiling window managers, and even with stacking window managers I tend to do everything re managing windows with Alt- key combinations (Win- combinations are used for launching programs, so win-w launches Firefox, for example)
    * -, _, {, }, and \ are the keys which I most frequently mis-hit or am annoyed by the placement of (and are mostly used by me, with the exception of _, when writing in LaTeX). N.B. I have a UK qwerty keyboard, and so the \ and | key is next to left-shift, so shouldn’t be as hard to hit as I find it :P
    * Home, PageUp, PageDown, and End are in irritating (and often non-standard) positions on all keyboards. I don’t know what I’d do with them, though.
    * I would love a dedicated leader key as easy to hit as , somewhere else. The number of times I wish I could use the , command in vim just keeps growing…

    Hmm, maybe I should remap capslock into a key…

    Reply  |  Quote
  2. joek UNITED KINGDOM Mozilla Firefox Linux says:

    @ joek:

    A few more things I just thought of:

    * My laptop’s keyboard (and lots of them which I’ve seen; I don’t know whether US keyboards have this) has a strange ‘right-click menu’ key to the immediate right of right-alt. I never use it.
    * I never use right-ctrl, either. It’s too far out of the way.
    * My little non-full-size laptop keyboard doesn’t have a scroll-lock, but it does have Pause|Break and PrtSc|SysRq. I don’t think any of those keys are really necessary…
    * For that matter, I’m not entirely convinced by the necessity of 12 F keys, but possibly some people use them…
    * The ` key, which again I use in LaTeX, is between Esc and Tab on a UK keyboard, and is really hard to hit.

    Reply  |  Quote
  3. Crprod UNITED STATES Netscape Navigator Mac OS says:

    Have you never supported accountants? The ones I supported always had CapLock on. The first step when seated at an accountant’s desk was always to turn CapLock off.

    Reply  |  Quote
  4. Robert UNITED STATES Safari Mac OS says:

    The Control key started out to the left of the A key, and this is the One True Place for your primary modifier key. I don’t know why some fool decided to waste prime real estate by changing it to the Caps Lock.

    Reply  |  Quote
  5. I completely agree with you on capslock, but otherwise you and I have very different keyboard habits, Luke.

    * I never use the right Alt key, always the left one. I would hate to use a keyboard where it has moved like you suggested. I count on it touching the x, so that when I type M-x in Emacs (run a command) I can do it in a pinching-like action with my left hand thumb and index finger.

    * I use both shift keys, the right one more frequently.

    * I absolutely hate keyboards without a control key on the bottom left corner. Many laptop keyboards are guilty of this, putting a special function key there instead. I use that control key frequently in Emacs so when it’s missing I’m severely hanicapped. I’ve considered remapping capslock to control, but it’s too hard to make that configuration portable.

    * Even as a Linux user, the Windows key is very handy for me and I’d hate to see it go. Emacs calls this the “super” key and I can use it for custom keybindings. However, I actually dedicate this key to my window manager (Openbox), so that its keybindings are effectively namespaced and therefore never conflict with Emacs. For example super+alt+arrow grows the current window in that direction up to the next window/screen edge (makes Openbox like a tiling window manager).

    * Yes, the special characters are a modifier key away when they probably shouldn’t be, but this doesn’t bother me. In Emacs, where I do 99% of my typing (including right now), I use an extension called YASnippet that enters a lot of these sort of keys for me. If I’m starting a new code block delimited by squiggly brackets, I just type the appropriate YASnippet prefix and hit tab. In Lisp modes I use an extension called Paredit, which types most parenthesis for me.

    * The other article mentioned PgUp and PgDown being outdated. I feel like I’m the only person left who reads computer screen text a page at a time. The other evidence I have for this is that Google+ articles can’t be read a page at a time due to Google+’s broken page layout (another reason I avoid visiting Google+). I do usually use spacebar for page-down, but if I need to reverse it I use PgUp. If the key started disappearing I’d remap it in my browser, but most people can’t do this.

    The keyboard layout standards are weak, but I can work around most of these weaknesses with software configuration. Trying to fix it just makes the problem worse because it breaks my configuration and muscle memory. I’d rather manufacturers stick to the same unoptimal design, which I’ve already fixed for myself, than each keyboard on the market being wildly unique in an attempt to optimize its use.

    Reply  |  Quote
  6. The main disadvantage of reinventing a wheel is that we can’t carry our favourite keyboard in our pocket. Everyone who ever tried to switch to Dvorak layout would admit: it’s perfect until you are forced to use an alien computer. As you sit in front of your wife/roommate/colleague’s laptop to help to fix smth, you immediately stuck with “fcuk, it’s like a keyboard in airport ticket printing machine”.

    That’s why I prefer to map 3rd level to what I use often, e.g. “AltGr+?” for “$” during accidental PHP coding. These keys are easily pressed simultaneously with one quick push, while such an action makes _no effect_ on stranger keyboards. That’s kinda Ockham’s razor.

    And, for God’s sake, please hands off CapsLock. We, non-ASCII alphabets users, need it to switch keyboard layout :-)

    Reply  |  Quote
  7. Peter GERMANY Mozilla Firefox Linux says:

    Have you ever looked at the german layout? If you want to type any of {[]}\ ,you have to use Alt Gr. Good thing that I wrote my thesis in LaTeX. You don’t have to use these in LaTeX at all. NEVER.

    There is an alternative layout that targets programming, the german language and english to a degree: . I used it for a couple of years and was mostly happy with it. I found it a lot better than the standard qwertz layout. It uses caps lock and other keys as modifier key to realise six layers. With the first three layers you have a lot of the special characters close to the home row. With the fourth layer you have the numbers and arrow keys right there. The last two layers I never used.

    I recently switched back to the standard layout because I want to get into system administration, potentially working on a lot of different machines. And that is the main porblem with non standard layout. You are completely hampered when you dont have it at your fingertips.

    Reply  |  Quote
  8. Nathan Mozilla Firefox Linux says:

    I don’t understand why all the best keyboards still use the rectangle o’ keys layout. As someone who deals with moderate wrist pain after a decade of professional programming, I *need* an ergonomic keyboard. Every time I see a post entitled ZOMG NEW KEYBORD JUST FOR HAXORS!!!1111 I read just enough of it to see that it still retains the same wrist-shattering form factor and then close the tab. Why not a keyboard that exists in two pieces and affixes to the arms of my chair? Why not a two-piece keyboard that straps to my wrist and lets me type with my hands wherever I bloody well want them to be, with an optical mouse sensor on the bottom so I can use the mouse without unstrapping my keyboards? Where’s the innovation in actual typing comfort?

    Reply  |  Quote
  9. @ Craig A. Betts:
    Sorry for my hanging link. Hopefully Luke can fix that. I blame the ANSI keyboard on my laptop. ;-)

    Reply  |  Quote
  10. Ron NEW ZEALAND Google Chrome Linux says:

    The super/windows is insanely useful, just not by default, rebind it to something else under Linux I use AwesomeWM and its my window manager modifier key, which is really great in that it doesn’t conflict with any other program I use.

    Reply  |  Quote
  11. Pollux Gluten CANADA Mozilla Firefox Ubuntu Linux says:

    What modern keyboards need is simple: a few modifier keys below the space bar (see Jef Raskin’s Leap keys on the Canon CAT), function keys to the left of the main block, and of course decent mechanical keyswitches and total remappability.

    Reply  |  Quote
  12. Ron NEW ZEALAND Google Chrome Linux says:


    All keyboards are totally remappable in software

    Reply  |  Quote
  13. k00pa FINLAND Mozilla Firefox Windows Terminalist says:

    I personally use cheap logitech keyboards (deluxe 250 something atm).

    These keyboards are almost indestructible and even if they break its so cheap to buy a new one. Also the most important thing: the key layout has been the same for logitech.

    Buying this “code” keyboard would result on a lot of typos for me, killing my productivity with the “wrong” layout. Also I don’t think there is a Scandinavian version of that keyboard…

    Also, I find it weird that you don’t use the alt + tab combo. I use it all the time, and I actually use the windows key a lot. Win + is very useful and fast way to start / switch to specific application, while win + arrow is really nice way to move windows around multiple screens.

    Reply  |  Quote
  14. Pollux Gluten CANADA Mozilla Firefox Ubuntu Linux says:


    Except for “Fn” keys that don’t transmit a keycode, or (thankfully rare) physically locking caps lock keys.

    Reply  |  Quote
  15. Joshua AUSTRALIA Mozilla Firefox Windows says:

    It’s been pointed out already, but portability is the issue. I could design a keyboard better suited to me, but it would wreak havoc on my workflow if i was ever without my beloved layout, hence it’s best to stick to the status quo and create custom shortkeys and hotkeys. AHK is awesome for this as it allows you not only to remap keys (any keys) and key combo’s, but you can also set up hot-keys to trigger a function or series of functions (eg. launch an app, send text, etc)

    Some examples. I created an alternate clipboard, for when I want to copy something else, but keep what’s on my clipboard. To do this I us Win+C and Win+V. I’ve got numlock mapped to : for entering times, MAC address, etc… I’ve got Win+LMouse mapped to “Ctrl-A, Ctrl-C” for quickly copying all text in a field. Plus much more that improve my workflow. Plus you can configure hotkeys to only trigger inside specific apps, so you can use the same hotkey in multiple apps but have it perform different tasks.

    Rather than completely change the layout, I merely extend it… so that when I’m at another persons PC, it’s just a minor inconvenience rather that a complete readjustment. Plus, AHK scripts can be compiled into an EXE so you can carry your mappings around with you easily.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *