Kinto is something I created recently that not only remaps the keyboard to be more mac like it will change the keymap, as needed for terminal usage and provides a custom keymap to handle Cmd + arrow keys system-wide. You no longer will need to specify a custom key binding in sublime text.
Initially Kinto did not handle Cmd + arrow keys, but that was literally one of the first issues someone brought up to me so I added it in by creating a native xkb keymap.
https://github.com/rbreaves/kinto
Update
Kinto now uses xkeysnail to simplify the remapping process.
Here's an example of the what the new config file looks like, but the full remap is part of Kinto and needs the latest xkeysnail from github, not the repos.
# -*- coding: utf-8 -*-
import re
from xkeysnail.transform import *
terminals = ["gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty"]
terminals = [term.casefold() for term in terminals]
termStr = "|".join(str(x) for x in terminals)
# [Conditional modmap] Change modifier keys in certain applications
define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,{
# Default Mac/Win
Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac
Key.LEFT_META: Key.LEFT_ALT, # WinMac
Key.LEFT_CTRL: Key.LEFT_META, # WinMac
Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac
Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac
})
# [Conditional modmap] Change modifier keys in certain applications
define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
# Default Mac/Win
Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac
Key.LEFT_META: Key.LEFT_ALT, # WinMac
Key.LEFT_CTRL: Key.LEFT_CTRL, # WinMac
Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac
Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac
})
define_keymap(None,{
# Cmd Tab - App Switching Default
K("RC-Tab"): K("RC-F13"), # Default
K("RC-Shift-Tab"): K("RC-Shift-F13"), # Default
K("RC-Grave"): K("RC-Shift-F13"), # Default
# K("RC-Tab"): K("RC-backslash"), # Chromebook
# K("RC-Shift-Tab"): K("RC-Shift-backslash"), # Chromebook
# K("RC-Grave"): K("RC-Shift-backslash"), # Chromebook
# In-App Tab switching
# K("M-Tab"): K("C-Tab"), # Chromebook - In-App Tab switching
# K("M-Shift-Tab"): K("C-Shift-Tab"), # Chromebook - In-App Tab switching
# K("M-Grave") : K("C-Shift-Tab"), # Chromebook - In-App Tab switching
K("Super-Tab"): K("LC-Tab"), # Default
K("Super-Shift-Tab"): K("LC-Shift-Tab"), # Default
K("LC-Grave") : K("LC-Shift-Tab"), # Default
# Wordwise
K("RC-Left"): K("Home"), # Beginning of Line
K("RC-Shift-Left"): K("Shift-Home"), # Select all to Beginning of Line
K("RC-Right"): K("End"), # End of Line
K("RC-Shift-Right"): K("Shift-End"), # Select all to End of Line
# K("RC-Left"): K("C-LEFT_BRACE"), # Firefox-nw - Back
# K("RC-Right"): K("C-RIGHT_BRACE"), # Firefox-nw - Forward
# K("RC-Left"): K("M-LEFT"), # Chrome-nw - Back
# K("RC-Right"): K("M-RIGHT"), # Chrome-nw - Forward
K("RC-Up"): K("C-Home"), # Beginning of File
K("RC-Shift-Up"): K("C-Shift-Home"), # Select all to Beginning of File
K("RC-Down"): K("C-End"), # End of File
K("RC-Shift-Down"): K("C-Shift-End"), # Select all to End of File
K("M-Backspace"): K("Delete"), # Delete
# K(""): pass_through_key, # cancel
# K(""): K(""), #
})
define_keymap(lambda wm_class: wm_class.casefold() not in ("code"),{
# Wordwise remaining - for Everything but VS Code
K("M-Left"): K("C-Left"), # Left of Word
K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word
K("M-Right"): K("C-Right"), # Right of Word
K("M-Shift-Right"): K("C-Shift-Right"), # Select Right of Word
# ** VS Code fix **
# Electron issue precludes normal keybinding fix.
# Alt menu auto-focus/toggle gets in the way.
#
# refer to ./xkeysnail-config/vscode_keybindings.json
# **
#
# ** Firefox fix **
# User will need to set "ui.key.menuAccessKeyFocuses"
# under about:config to false.
#
# https://superuser.com/questions/770301/pentadactyl-how-to-disable-menu-bar-toggle-by-alt
# **
#
})
define_keymap(re.compile(termStr, re.IGNORECASE),{
# Ctrl Tab - In App Tab Switching
K("LC-Tab") : K("LC-PAGE_DOWN"),
K("LC-Shift-Tab") : K("LC-PAGE_UP"),
K("LC-Grave") : K("LC-PAGE_UP"),
# Converts Cmd to use Ctrl-Shift
K("RC-Tab"): K("RC-F13"),
K("RC-Shift-Tab"): K("RC-Shift-F13"),
K("RC-V"): K("C-Shift-V"),
K("RC-MINUS"): K("C-Shift-MINUS"),
K("RC-EQUAL"): K("C-Shift-EQUAL"),
K("RC-BACKSPACE"): K("C-Shift-BACKSPACE"),
K("RC-Q"): K("C-Shift-Q"),
K("RC-W"): K("C-Shift-W"),
K("RC-E"): K("C-Shift-E"),
K("RC-R"): K("C-Shift-R"),
K("RC-T"): K("C-Shift-t"),
K("RC-Y"): K("C-Shift-Y"),
K("RC-U"): K("C-Shift-U"),
K("RC-I"): K("C-Shift-I"),
K("RC-O"): K("C-Shift-O"),
K("RC-P"): K("C-Shift-P"),
K("RC-LEFT_BRACE"): K("C-Shift-LEFT_BRACE"),
K("RC-RIGHT_BRACE"): K("C-Shift-RIGHT_BRACE"),
K("RC-A"): K("C-Shift-A"),
K("RC-S"): K("C-Shift-S"),
K("RC-D"): K("C-Shift-D"),
K("RC-F"): K("C-Shift-F"),
K("RC-G"): K("C-Shift-G"),
K("RC-H"): K("C-Shift-H"),
K("RC-J"): K("C-Shift-J"),
K("RC-K"): K("C-Shift-K"),
K("RC-L"): K("C-Shift-L"),
K("RC-SEMICOLON"): K("C-Shift-SEMICOLON"),
K("RC-APOSTROPHE"): K("C-Shift-APOSTROPHE"),
K("RC-GRAVE"): K("C-Shift-GRAVE"),
K("RC-BACKSLASH"): K("C-Shift-BACKSLASH"),
K("RC-Z"): K("C-Shift-Z"),
K("RC-X"): K("C-Shift-X"),
K("RC-C"): K("C-Shift-C"),
K("RC-V"): K("C-Shift-V"),
K("RC-B"): K("C-Shift-B"),
K("RC-N"): K("C-Shift-N"),
K("RC-M"): K("C-Shift-M"),
K("RC-COMMA"): K("C-Shift-COMMA"),
K("RC-DOT"): K("C-Shift-DOT"),
K("RC-SLASH"): K("C-Shift-SLASH"),
K("RC-KPASTERISK"): K("C-Shift-KPASTERISK"),
}, "terminals")
https://medium.com/@benreaves/kinto-a-mac-inspired-keyboard-mapping-for-linux-58f731817c0
Here's a Gist as well, if you just want to see what is at the heart of it all, it will not alternate your keymap when needed though. The Gist also does not include custom xkb keymap files that setup macOS style cursors/word-wise manipulations that use Cmd and the arrow keys.
https://gist.github.com/rbreaves/f4cf8a991eaeea893999964f5e83eebb