How I mapped some basic keys to be the same on MacOS and Ubuntu and saved my sanity. UPDATED! UPDATED AGAIN!
Problem Statement
I move back and forth between MacOS and Ubuntu. I work in the terminal a lot and I’m shifting to using zed as my primary work editor. Why? It’s fast, and it’s EASY to configure. For me the learning curve of VSCode is too steep and I don’t need all the features. I just need a fast editor that I can EASILY configure to my liking. Oh, that is easy to bind an LLM to for assisted code.
You ARE using an LLM, right? If not, you should be. I use CoPilot and am testing others as well.
AI won’t take your coding job. But another developer skilled in using AI almost certainly will. You have been warned!
UPDATE - Possible Overkill But It Works sort of works!
This intercepts all keypresses at the X11 level and remaps the Super key to the Control key. This means that a super-c becomes a control-c. Probably not what you want if you use an actual linux terminal (and I do). But the alternative is to remap the keys at the application layer, and that means doing each one, one by one… ugh. I will probably back this out unless I can find a “terminal” program that is actually an X11 program and not a terminal emulator.
Warning: this will whack your terminal keybindings!!!!
Edit a new file .Xmodmap in your home directory and add the following:
remove mod4 = Super_L
keysym Super_L = Control_L
add Control = Control_L
Then run the following command:
xmodmap ~/.Xmodmap
This will remap the Super key to the Control key. This is a bit of overkill, but it works. I’m still testing it, but so far it seems to work well.
If this works for you then you can probably skip the rest of this article. I’m leaving it here for reference and in case the above doesn’t work for you.
This works for me because I don’t use the Super key for anything else. If you do, then maybe don’t do this.
CREDIT: I found this in an 8 year old post on AskUbuntu.
Ubuntu - Unbinding Keys
In settings, go to keyboard –> keyboard shortcuts –> system
- disable the “show the notification list”
- disable the “open the quick settings menu”
These will release the Super+V and Super+C keys for use in zed.
Zed Keymaps
Here’s how I mapped the keys in zed:
// Zed keymap
//
// For information on binding keys, see the Zed
// documentation: https://zed.dev/docs/key-bindings
//
// To see the default key bindings run `zed: open default keymap`
// from the command palette.
[
{
"context": "Workspace",
"bindings": {
// "shift shift": "file_finder::Toggle"
}
},
{
// "context": "Editor",
"bindings": {
"ctrl-x ctrl-s": "workspace::Save",
"ctrl-c": "editor::Copy",
"ctrl-v": "editor::Paste",
"super-c": "editor::Copy",
"super-v": "editor::Paste",
"super-x": "editor::Cut",
"super-s": "workspace::Save",
"ctrl-a": "editor::MoveToBeginningOfLine",
"ctrl-e": "editor::MoveToEndOfLine",
"super-z": "editor::Undo",
"super-f": "buffer_search::Deploy"
}
}
]
NOTE: this is a snapshot as of this writing. The actual up to date configs are in my zed repo.
Linux Terminal
To get the same basic “copy” and “paste” keys in the terminal, I did the following:
In terminal –> preferences –> Shortcuts
- under Edit, map Paste to Super+V
- under Edit, map Copy to Super+C