HELL = Shift+Enter => Enter
Your writing a long prompt in you CLI coding agent tooling and you want to create a blank line for a new point, code code block, etc., and you accidently type Shift+Enter...
The Terminal did it - The Terminal hit Enter
If you've started using AI coding assistants (like aider, gpt-me, or open-code) directly in your terminal, you've likely run into a frustrating muscle memory clash around Shift+Enter.
In web chats, Teams, Slack, and VSCode Code Assistants, Shift+Enter gives you a New Line, while Enter sends the message. However, most CLI coding agent tools follow the Terminal keyboard standards/behaviors (if you are reading this, the Terminal standards were more than likely written before you were born: ASCII(1963), and VT100(1978) aka boomer old school) :
| Key Command | Key Operation |
|---|---|
Enter |
Submit |
Shift+Enter |
Submit |
Ctrl+Enter |
New Line |
Often the CLI coding agent will remap the key command based on its editor setting exposed by its /editor command. But if you're like me and want the freedom of using the editor without the CLI coding assistant file noise, there is no real way in the CLI coding assistant to change the Shift+Enter key command's key operation.
There a way to fix this problem globally on Linux (including WSL) using keyd.
keyd
keyd is a powerful key remapping daemon for Linux that intercepts keys and key sequences and remaps them to other keys and key sequences.
We will configure keyd to run at startup using systemd map the Shift+Enter key command to the Ctrl+Enter key command.
Steps
Step 1 - systemd
If you already have systemd installed in your environment, jump to Step 2.
To verify if systemd is installed and running on your Linux instance, you can use the following command:
which systemctl
$ which systemctl
/usr/sbin/systemctl
Installation of systemd is beyond this post and is Linux distro-specific. If you are running WSL, systemd is configured in your /etc/wsl.conf file:
/etc/wsl.conf
[boot]
systemd=true
Step 2 - keyd installation and configuration
keyd installation
Install the keyd daemon using the package manager of your Linux distribution. For Arch Linux this is pacman:
sudo pacman -Syu keyd
Substitute with your distribution's package manager: apt, yum, emerge, etc.
keyd configuration
With keyd installed, you need to configure it. Edit the /etc/keyd/default.conf file as admin in your favorite editor:
/etc/keyd/default.conf
[main]
# Explicitly map physical shifts to the shift layer
leftshift = layer(shift)
rightshift = layer(shift)
[shift]
# When shift is held, Enter sends Control+Enter instead
enter = C-enter
kpenter = C-enter
Step 3 - Enable and start the keyd service
To enable the key remapping, run the following command:
Execute: systemctl enable
sudo systemctl enable --now keyd
Result
$ sudo systemctl enable --now keyd
Created symlink '/etc/systemd/system/multi-user.target.wants/keyd.service' → '/usr/lib/systemd/system/keyd.service'.
To verify there are no errors you can run the following:
Execute: systemctl status
sudo systemctl status keyd
Result
$ sudo systemctl status keyd
● keyd.service - key remapping daemon
Loaded: loaded (/usr/lib/systemd/system/keyd.service; enabled; preset: disabled)
Active: active (running) since Thu 2026-03-26 10:58:09 CDT; 1h 5min ago
Invocation: 34ce0111ca5b4fbaa26742195cd99602
Main PID: 218399 (keyd)
Tasks: 1 (limit: 13704)
Memory: 19.3M (peak: 19.8M)
CPU: 37ms
CGroup: /system.slice/keyd.service
└─218399 /usr/bin/keyd
These keyd mappings take effect immediately, letting you enjoy both Shift+Enter and Ctrl+Enter in your AI coding assistant.
Note
The keyd service can be disabled by running the following:
Execute: systemctl disable
sudo systemctl disable --now keyd
Result
$ sudo systemctl disable --now keyd
Removed '/etc/systemd/system/multi-user.target.wants/keyd.service'.
Top comments (0)