Skip to main content

Keyboards, Shortcuts, and Vim layouts

·2015 words·10 mins
Gary <Tolki> Mialaret
Author
Gary Mialaret
Gaming, Software Development, Data Science, Fitness
Table of Contents

There are nerds, but even among nerds there are things where I go above and beyond traditional nerdiness. One of those things is keyboards and shortcuts.

I’ve always found keyboards fascinating. With up to 100 keys and all 10 fingers using them. The input possibilities are staggering. The keyboard paradigm is still in use on touchscreens because of how intuitive it is.

Despite that most workflows are mouse-driven. Typing properly on a keyboard is a skill that is being lost. And most programs release with few, if any, keyboard shortcuts.

So let’s walk you through my 10 years journey on keyboards, layouts, shortcuts maps, and Vim.

The genesis #

In early 2010 I had to do a team project for my first year in engineering school. I managed to convince 5 people to create a futuristic keyboard. The idea was that keys resistance would change with the probability of hitting them, meaning that typos would have physical feedback. We made a 5-keys prototype that weighed 1kg and was pretty sick.

I was in charge of the software side. As key prediction required analyzing a lot of text, I used that occasion to determine the most optimized keyboard layout for minimizing typos and maximizing typing comfort. The answer was bépo and that’s how my weird keyboards journey began.

No surprise I’m still a keyboard nerd 13 years later.

Layouts #

The bépo years #

My switch to bépo was an epiphany. Learning to type in a new layout actually takes little time and yields tremendous ergonomic benefits.

You exchange ~2 weeks of typing speed for decades of reduced wrist strain. Proper keyboard layouts focus on alternating hand and on minimizing travel distance of fingers to reduce strain. It feels like a breeze to type.

The added benefit is that you’ll be forced to touch type since the symbols on your keyboard will be meaningless. By being forced to touch type and never take my eyes off the screen I easily reached 100 wpm, which I never did in AZERTY.

Over the years I convinced my mom and multiple of my close friends to make the switch. Not a single one regretted it. Once you switch, you’ll never go back.

The Dvorak switch #

I loved bépo but it is specialized for French. As I started typing in English more and more I started to loath the 4 keys dedicated to accentuated characters. I wanted better access to symbols and less reliance on AltGr as it plays poorly with many shortcuts.

Dvorak also had convenience on its side. Being english-focused it is installed on all Windows, Mac OS, and Linux machines by default. This makes things much easier when I want to use a friend’s PC or simply for support on phones virtual keyboards.

The switch was worth it. Typing English became much easier as keys like w moved from the corners of the map to central positions. I was missing accents though, but nothing you can’t fix with a custom layout as we’ll see later!

Keyboards #

Let’s start by talking about the hardware.

My first mechanical keyboard was an ISO Filco Majestouch in 2010. An ISO keyboard is a keyboard with a “big-ass Enter” key (yes, that’s how they’re called in the community).

While it was a great keyboard I preferred the longer Enter key as it required less right hand movement to type it so I moved to an ANSI keyboard in 2012.

But this was not enough. In 2019 I caved in to my darkest pulsions and built my first split orthogonal keyboard: an Ergodox Ez.

My first custom keyboard

I loved it but the micro-USB connector died after a year of abuse. I could have replaced the micro-controlled and salvaged it, but I wanted something more sturdy and well-built.

I got the Moonlander MKI in summer 2020. The god of keyboards.

As of 2023, this is still the keyboard I’m using. My only qualm with it is that I can’t take it everywhere with me. I’ll change keyboards when they make a wireless version that uses low profile switches!

Talking about switches I experimented quite a bit. From brown, to blue, to red, to silent browns, to silent reds, to custom linear and tactile switches. In conclusion I quite like silent linear keys, and I currently use Healio V2 switches on my keyboard.

Physical layout #

While I was using standard keyboards I never really thought to question the layouts themselves. But once I started using split orthogonal keyboard with custom firmware, the floodgates opened.

I went through so many revisions that I can’t list them all, but the biggest change I have made is to use home-row modifiers.

This means that when I tap a key on my home row, it produces the letter. But when I hold it, it becomes a modifier. My home row behaves the same on both hands:

  • Index finger switches layer for the opposite hand
    • Left hand is arrows
    • Right hand is numbers
  • Major finger is control
  • Ring finger is alt
  • Pinky is win/cmd

This reduced my finger travel by another huge chunk. To do ctrl+left, which moves the cursor at the start of a word, I can now stay on the home row. This is a game changer for ergonomics and shortcuts.

The other big bonus of ergonomic keyboards is the increased focus on the thumb. On standard keyboards both thumbs only has access to the space bar which is a tremendous waste. Humans have very agile thumbs and they are a perfect fit for non-alphabetical keys and modifiers.

After a lot of experimentation and back and forth I have the following keys on my thumbs:

  • Left
    • Tab
    • Space
    • Enter
    • Escape
  • Right
    • Del
    • Shift
    • Backspace
    • Win/cmd

my keymap

You can see my current layout here on the Oryx configurator and believe me when I say I spent way too much time on that. It feels great though!

Shortcut maps #

In every game I play or software I use the first thing I do is check keyboard shortcuts. Usually only the most important functions get shortcuts assigned so it’s a good starting point to learn how to use a program.

Over the years I realized there are 3 types of shortcuts:

  • Mnemonics-based shortcuts

    • Those are the ones trying to map a letter to a function, like ctrl+o for Open or ctrl+n for New
    • They are the most popular overall but there are only so many keys on a keyboard!
    • They play very nicely with ergonomic layouts as most words start with letters accessible on home rows
  • Position-based shortcuts

    • Those shortcuts are based on the physical position of the keys, like ctrl+v being chosen for Paste due to its proximity with ctrl+c
    • This applies to almost all buttons/shortcuts in video games, with WASD for movement being the most famous example
    • Those are often awful for us ergonomic layout users as they end up completely arbitrary when based on QWERTY!
  • Random shortcuts

    • Of course, some shortcuts just make absolutely no sense and are just chosen because there is no better option
    • Vim has quite a few of those, like . for repeating the last command. It’s a crucial feature but its key makes no mnemonic sense and is poorly placed

So I usually end up remaking almost all shortcuts for any program I use so they stay coherent. This sometimes takes me up to 10 hours and is never worth it, but I’ll keep doing it for my own sanity!

And I promise that when I’ll release a program, it’ll have great shortcuts.

Vim #

vim triggered me to write this post. Two weeks ago I wanted to review my Visual Studio Code shortcuts and I realized I likely should just learn vim as I was looking for a keyboard-focused workflow.

Let’s start with the good, which are the reasons to use vim:

  • Being a modal editor is great
    • Gives direct access to core features like caret movement or copy/pasting without modifiers
    • Extra modes like EasyMotion can easily extend features
  • Great editing features
    • Repeating inputs, multiple copy/pasting registers, …
    • Just read “Practical Vim” if you want to understand how powerful vim is!
  • No need for arrows or backspace
    • Pointless with my Moonlander, but I still use my Mac keyboard regularly!

The reason I never used Vim was very simple: its default and widely accepted key map is absolutely awful and the advice from all Vim users is just to get used to it. You can tell they’re mostly QWERTY users used to running their hands all over the keyboard.

The real reason to not change the default key map is that vi, vim, and nvim are all heavily customizable but all make the same assumption: you will not change the normal mode keys.

The issue is that the normal mode keys are the product of idiosyncrasy:

  • HJKL is 2D movement because that’s what was printed on a keyboard 50 years ago
    • It’s not even the home row, two keys are assigned to the index finger!
  • u is undo because of mnemonics, but redo is ctrl+r because r was already take by replace.
    • But for many other functions reverting the function is shift+key!
  • ctrl+o is… Undo last motion, because why not!
  • 0 is line start, ^ is non-blank line start, $ is line end. If that makes any sense to you please enlighten me
    • You can also use | to go to line start btw
  • o is Insert new line because of its proximity to i (I think), but it’s much more closely related to a (append) as it writes a new line after the content
  • My biggest pet peeve is change taking up c, leaving copy to y being “mnemonic” as “yank”. Except yank heavily implies removing the content.

Overall, the key map is a mess. I really love the idea of having access to keys like “go to next word” without needing to press a modifier but I’d really like for them to be more intuitive.

So, I just spent almost a week trying to do that:

vim key map

This is heavily work in progress and you can check the latest version here.

Here are the core tenets of this layout:

  • It is optimized for my usage with a Dvorak split orthogonal keyboard
  • Motions and operators are split
    • You alternate between those so it feels great!
  • The most important operators and functions are placed on the home row or very close keys
    • Undo, Paste, and Repeat are all there!
    • Copy and Paste are on different fingers so copy copy paste (copy line below) is a short roll
  • Motions are all location-based and related insert motions are around

I’m not satisfied with where it’s at yet. And unfortunately a ton of programs and websites use a vim-like shortcut map by default (lazygit, twitter, gmail, …), so I still need to memorize HJKL for movement anyways.

Some WiP notes:

  • Motions on the right hand might be better as it allows to enter numbers more easily from the left hand so I might try that next
    • The issue with right hand motion is that I then lose almost all mnemonics as Dvorak has consonants on the right hand
  • I might go back on b and w for word start motion as they are used by many plugins (EasyMotion) and w is also used as a text object

I think over time this will develop into its own NeoVim distribution. I want to add function hints in the form of an HUD inspired by RTS games like StarCraft 2 or Age of Empires:

StarCraft HUD

If those games can have tens of functions available to your left hand in an easy to memorize way, why can’t vim?

Conclusion #

Right now, I use:

  • A Moonlander with Healio silent linear switches
  • The Dvorak keyboard layout
  • VSCode with VSCodeVim as my main text editor, coupled with a really weird vim shortcuts map

I’m decently happy with where I’m at and my text and code editing speed, but I know I can do better and never lose my flow state!

So until I find the perfect input solution, I will keep on iterating.