Tag: keyboard

Setting Up a Raspberry PI with a German Mac Keyboard

This is another “Note to self” post.

For a workshop I will present at the Agile Testing Days 2022, I’ve set up a backup computer, in case folks don’t have Ruby installed on their machine already, or don’t get it installed within the available time slot.

The Raspberry itself had already worked … with some keyboard back in 2017 (when I used it in a ½ days tutorial at the same conference). But now, I connected a Mac keyboard to it, one with a German layout – including the umlauts. Getting the configuration to work well enough was surprisingly hard.

The existing keyboard configuration didn’t work very well, since it expected an international layout, meaning that the key cap labels weren’t always correct. Or the printed key wasn’t, depending on your perspective.

Setting it up using the GUI application that comes with RaspbianOS didn’t work so well either: for some configuration settings the keyboard stopped reacting completely. Yay! I learned another way how not do do it. 🤣

In the end I used the terminal raspi-config:

sudo raspi-config
A screenshot of the 'raspi-config' tool as displayed in a terminal window

to try all variations of (non-japanese) Apple keyboards with the corresponding German layouts and variants.

In the end I settled with this configuration, as it is stored in /etc/default/keyboard on the Raspi:

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL=apple
XKBLAYOUT="de"
XKBVARIANT=
XKBOPTIONS="lv3:ralt_switch,terminate:ctrl_alt_bksp"

BACKSPACE="guess"

Moving Left and Right in zsh (in macOS)

I use the command line a lot on my Macs, in particular, I use iTerm2.

When moving left and right in a command the shortcuts I knew about so far were:

Key (combination)Moves Cursor…
Right Arrow ‘→’One character right
Left Arrow ‘←’One character left
CTRL + aBeginning of the line
CTRL+ eEnd of the line

After adding the following lines to ~/.zshrc, I now can also move left and right per word using ALT-← and ALT-→ respectively:

bindkey "[D" backward-word # ALT-left-arrow  ⌥ + ←
bindkey "[C" forward-word  # ALT-right-arrow ⌥ + →

Especially when moving around in long command lines, this is really convenient & saves a lot of time.

Do you have keyboard shortcuts that you use regularly on the command line (or elsewhere)? I’d love to hear about them!

%d