• You are not logged in.
  • Index
  • General
  • Just another fun Layout: nreik (Programmers Dream)

Just another fun Layout: nreik (Programmers Dream)

  • Started by sensille
  • 28 Replies:
  • Reputation: 0
  • Registered: 12-Jan-2009
  • Posts: 9

For years I'm very frustrated with the standard qwerty layout while doing heavy C-programming. The right pinky is used about 30% of the time and it is impossible for me to keep up strict touch typing. Some years ago I tried to solve it learning dvorak. It went quite well, but didn't really mitigate the problems when programming C. Since then I keep having an eye on new layouts.
While I'm sure colemak is great for regular text, it doesn't help when programming. The only solution seem to be to introduce more modifier keys, but I don't like the idea.
When the idea of wide layouts came up, I decided to create my own layout targeted for programming.
I tried several of the existing layout optimization programs, but none of them could fully handle relocation of the special characters. So another layout optimizing project started ;)
My goal was to fully model the usage of the shift keys, to have a real measure of the costs for special characters. At first, I imitated the existing cost functions like same finger, same hand, row jump, ..., but they had too many parameters for me.
My approach is a bit different: I measured the hands and how far every finger can reach in every direction. Also I measured the key distances on my cherry keyboard. The model now fully track hand positions, hand angles, finger positions and finger angles and the cost is mainly attached to the movements of the fingers and the hands, finger and hand exhaustion be repetition etc. Also there is a penalty on hand change. To get the cost of a specific layout, the full corpus is fed into the cost function and normalized afterwards. That way I hope to get a more accurate cost, especially because it really takes the cost of shift into account, depending on the current hand positions.
Of course this cost function is much too expensive to calculate it millions of times during the optimization process, so I tried to approximate it by using quad-grams. It only feeds the 99%-quantile of the quad-grams from the corpus, about 300.000. The error of this approximation is about 10%, but the relation to the real costs stay nearly constant, so I deemed it good enough.
As corpus I took large chunks of the linux kernel, the corpus carpalx uses and tons of perl sources.

During the coding process, someone pointed me to the upcoming TrulyErgonomic keyboard. I fell in loves with it on first sight and now eagerly await its appearance. My initial plan as stated above was to optimize for a wide layout, but a wide layout wouldn't make much sense on the TrulyErgonomic, so I stuck with the regular (narrow) hand position to make the transfer to the TrulyErgonomic easier.

But enough of this length introduction, this is the result:

% + < > / \ [ ] " . ! z ^
  & l o u , @ d p _ x q j
  n r e i ; k t s a c b v
  h ( ) y = w m f - g

? | 2 3 4 5 6 7 8 9 ~ Z `
  # L O U 0 1 D P * X Q J
  N R E I $ K T S A C B V
  H { } Y ' W M F : G 

At first sight it looks a bit crowded, but when using it, the feeling quickly goes away. Nevertheless I'm still not sure what to think about it. I'm learning it in my spare time now, and there are lots of rolls in there that feel nice, but it also alternates a lot. I tried to model the cost to prefer small roles followed by a hand change.
I find it surprisingly easy to learn, but it takes time to pick up some speed on it.

Hopefully some of you also pick up on this :)

Last edited by sensille (25-Feb-2011 06:28:13)
Offline
  • 0
  • Reputation: 0
  • Registered: 12-Jan-2009
  • Posts: 9

Just to give you an idea of the cost function, here are some results for known layouts.

a) With my mixed corpus:

qwerty: 13.808918
dvorak: 13.713634
dvorak-p: 13.051499
workman: 12.756147
workman-p: 12.782647
colemak: 12.528149
carpalx-best: 12.952169
nreik: 8.582116

b) With the text corpus, taken from carpalx:

qwerty: 9.225186
dvorak: 8.798838
dvorak-p: 8.707162
workman: 7.076040
workman-p: 7.067993
colemak: 7.221865
carpalx-best: 7.379503
nreik: 6.853381

[edit] added some more layouts

Last edited by sensille (26-Feb-2011 20:21:36)
Offline
  • 0
  • Reputation: 0
  • Registered: 24-Feb-2011
  • Posts: 40

I think that, especially for programming, using a corpus comprised of finished code might be misleading. A large amount of the keystrokes are editing and cursor movement related, which are not accounted for. A vim user will have heavy use of ESC, an emacs user has Ctrl combinations, and there are many arrows and page up-downs and so on. Has anyone used a keylogger to get some idea of how common these non-printed chars are?

Offline
  • 0
  • Reputation: 0
  • Registered: 12-Jan-2009
  • Posts: 9
innovine said:

I think that, especially for programming, using a corpus comprised of finished code might be misleading. A large amount of the keystrokes are editing and cursor movement related, which are not accounted for.

This is certainly true, but I have no access to any such data. So the best I have is the finished code. For quite some time I experimented with penalties for the placements of hjkl, but in the end decided against it. Having especially J in a prominent position raises the cost significantly (measured against a corpus that doesn't contain this specific usage of hjkl).
Also, while in the process of editing, the flow is not especially important, as only short sequences, but many repetitions are used. Admittedly, having J on the right pinky is not the most comfortable choice for vi usage.

Offline
  • 0
  • Reputation: 2
  • From: Aalborg, Denmark
  • Registered: 18-Feb-2011
  • Posts: 166
sensille said:

Admittedly, having J on the right pinky is not the most comfortable choice for vi usage.

Yeah, I think this is pretty important for a programmers layout. My biggest reason for not learning Colemak was actually the location of 'j' until someone said it wasn't a big problem (for him at least) (and now I've started learning it).

But it's tough since 'j' is such a rare letter outside of vim.

And while we can remap vim, other less customizable programs also imitate vi keybindings, less being the most frequently used for me, for some, it's probably vimperator.

Offline
  • 0
  • Reputation: 0
  • Registered: 12-Jan-2009
  • Posts: 9

Just as a follow up, to further validate the cost function I made the following experiment:
I added to the search similar restrictions that hold for colemak:
a) keep zxcv
b) change as few keys as possible
c) keep numbers and special characters in place

It came up with layouts with the following scores:
colemak: 7.221865 (17 keys)
14 keys: 7.187996
18 keys: 6.982921

I find this result quite encouraging. It tells me, that colemak is quite optimal with respect to my cost function and the given constraints. On the other hand, this means the cost function cannot optimize for the completely wrong thing. In that case it would have come up with a much better score than colemak.

In a further experiment, it optimized for
a) keep only cv
b) change as few keys as possible
c) only keep numbers in place,

so it was allowed to swap characters with special characters. The result was:

18 keys: 6.440784

As corpus I used the carpalx books.txt for all experiments.

Offline
  • 0
  • Reputation: 0
  • Registered: 03-Jul-2009
  • Posts: 189
innovine said:

I think that, especially for programming, using a corpus comprised of finished code might be misleading. A large amount of the keystrokes are editing and cursor movement related, which are not accounted for. A vim user will have heavy use of ESC, an emacs user has Ctrl combinations, and there are many arrows and page up-downs and so on. Has anyone used a keylogger to get some idea of how common these non-printed chars are?

Xah Lee made a related experiment, and designed an ergonomic layout for Emacs, available for Colemak too:

http://xahlee.org/emacs/command-frequency.html

Dvorak typist here.  Please take my comments with a grain of salt.

Offline
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8

Is there a MSKLC file of this nreik layout? has anyone tried it for long time? is it worth migrating from dvorak?

Offline
  • 0
  • Reputation: 214
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,371

Heh, I wouldn't dig that one up if I were you. It might start gnawing on your brains. ;)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Online
  • 0
  • Reputation: 4
  • Registered: 04-Feb-2010
  • Posts: 149

@Absolute Beginner- If you are a windows user, and are already using Dvorak you might want to try something like "Developer's Dvorak". It can be found over at http://www.andong.co.uk/dvorak/DDvorak. … e=Overview. There is a light version which simply adds a symbol layer using comma as a deadkey. Turning capslock into its own layer would probably have been more efficient, but that isn't supported by MKLC. If you are looking for a bit more, the standard version uses the comma deadkey, swaps the u/i, adds cut/copy/paste/save buttons, puts a numberpad on the AltGr layer, and shuffles some function keys around. That one requires a bit of do-it-yourself on the set up though.

Offline
  • 0
  • Reputation: 4
  • Registered: 08-Dec-2010
  • Posts: 656

I think .NET and/or Java deserve another optimal layout.

Offline
  • 0
  • Reputation: 214
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,371

If you need CapsLock to make a layer, use PKL. It's what I do.

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Online
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8
cevgar said:

@Absolute Beginner- If you are a windows user, and are already using Dvorak you might want to try something like "Developer's Dvorak". It can be found over at http://www.andong.co.uk/dvorak/DDvorak. … e=Overview

I've seen that. Even sensille answered that tread but he vanished. I thought maybe nreik is an ultimate layout and worth learning?

Tony_VN said:

I think .NET and/or Java deserve another optimal layout.

thought that Java/C# are all like C derivatives and the "C" layout will fit them prefectly

Offline
  • 0
  • Reputation: 7
  • Registered: 21-Apr-2010
  • Posts: 818

With Java and C# you'll spend half your life hitting the shift key (oh okay - the underscore, requires an extra keypress too.)

--
Physicians deafen our ears with the Honorificabilitudinitatibus of their heavenly Panacaea, their sovereign Guiacum.

Offline
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8

well seems like noone knows where sensille is and how to contact him, so I'll try to use MSKLC  and create keyboard myself

Last edited by Absolute Beginner (06-Jul-2012 10:55:25)
Offline
  • 0
  • Reputation: 214
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,371

Sounds like a wild goose chase to me. I think Sensille is overdoing it. Abandoning layouts that are good for text because you need to code sounds overmuch. Instead I'd look into making some tweaks and additions to existing layouts like Colemak to optimize for coding - like what has been done for Dvorak as mentioned by others in this thread. Less is more, Keep It Simple Stupid etc etc. Of course, I am the prophet of modularity these days... :)

For me, the most important improvement is the addition of the Extend layer for easy navigation and editing. That really helps my coding!

Last edited by DreymaR (06-Jul-2012 11:43:49)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Online
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8

Abandoning layouts that are good for text because you need to code sounds overmuch.

not @ all. some people code for living and coding is >80% of their keyboard use. So to beat {}<>'_ /\@#&?[] is a total PITA and like 30-50% of keypressing. it totally different from using keyboard for emails, sms,  writing, social networking and stuff

anyway I'm choosing now btwen SDDvorak, nreik and workman

the most important improvement is the addition of the Extend layer for easy navigation and editing. That really helps my coding!

Well, i've seen Neo layout, 5 layers is fine, thought about making it default. Any reports and success stories?

Offline
  • 0
  • Reputation: 214
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,371

Again, I advise you to think in modules - which is what we programmers like to do anyway! :)

For me, the text block needs to be good for text which means I want a good layout (Dvorak or Colemak test well and have good user groups). Then, to get a good coding block I'd use a modifier key. In my experience the CapsLock is surprisingly good at this! User TomLu made a block like that for coding, which was discussed a while back with input from others:

https://forum.colemak.com/viewtopic.php?id=558
https://forum.colemak.com/viewtopic.php?id=524

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Online
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8
DreymaR said:

In my experience the CapsLock is surprisingly good at this! User TomLu made a block like that for coding

Maybe, maybe, I'm choosing and pondering
but anyway, author says that his layout is also good for texting better than colemak, dvorak etc... Just he is gone and didn't tell what his cost function optimize

So, is there MSKLC layout to download?

My head is overloaded now. Gonna read real use success stories here

Offline
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8
Offline
  • 0
  • Reputation: 0
  • Registered: 12-Jan-2009
  • Posts: 9
Absolute Beginner said:

Is there a MSKLC file of this nreik layout? has anyone tried it for long time? is it worth migrating from dvorak?

Sorry for replying late, here it is:

http://sensille.com/NREIK_amd64.msi
http://sensille.com/NREIK_i386.msi

and the source

http://sensille.com/nreik.klc


Have fun with it and let me know how you're doing :)

Offline
  • 0
  • Reputation: 0
  • Registered: 03-Jul-2009
  • Posts: 189

Very interesting. Congratulations for thinking out of the box and scattering the characters all over the available keys.

I've not used the layout, but I have a few observations anyway:
- a frequent letter such as O might deserve a better placement. As things are now, an awkward side movement is required.
- IMO, the key currently assigned to P is the best key outside the home row, and thus wasted on P.
- [ and ] on the same finger are fine for the C language, where they are never pressed in succession, but they may be awkward for other languages you may want to learn in the future.
- [0] does not look as a smooth sequence... maybe you could swap 1 e 0.
- Q and V could be swapped. IMO, the key currently assigned to Q is better, albeit not on the home row.
- Vi clones, including Vim, often allow key remapping, so I wouldn't concern myself too much with the positions of certain characters.

Thank you for sharing.

Last edited by spremino (14-Jul-2012 00:28:52)

Dvorak typist here.  Please take my comments with a grain of salt.

Offline
  • 0
  • Reputation: 0
  • Registered: 05-Jul-2012
  • Posts: 8

I presume it'll do for amd64 windows http://oron.com/w57qtksif7zr
Unpack with 7zip

Offline
  • 0
  • Reputation: -5
  • From: Banned
  • Registered: 02-May-2015
  • Posts: 116

Swap braces with square parentheses, having braces in shift space is not good.

Banned from Colemak

Offline
  • 0
  • Reputation: 0
  • From: Poland
  • Registered: 06-Jan-2015
  • Posts: 26

() are not under shift. {} are.
And everything is in its proper position: normal () and square [] brackets are used commonly, curvy {} brackets - depending on a language used (e.g. in Python space at the beginning of the line is used instead).

If you want to seek errors in a dead topic, here is a better one: <= and >= are row-jumping strokes. Same hand, 3 rows. That's a new record. :D

Offline
  • 0
  • Index
  • General
  • Just another fun Layout: nreik (Programmers Dream)