Is there a way to make alt-f and alt-b jump word forward and backward instead of printing ƒ and ∫...
Categories:
Reclaiming Alt-F and Alt-B for Word Navigation on macOS

Learn how to remap the Alt-F and Alt-B key combinations on macOS to perform word-by-word navigation, preventing them from printing special characters like 'ƒ' and '∫'.
Many users accustomed to Linux or Windows environments, or those who frequently use Emacs-style keybindings, find the default behavior of Alt-F
and Alt-B
on macOS frustrating. Instead of moving the cursor forward and backward by a word, these key combinations often produce special characters like 'ƒ' (function) and '∫' (integral). This article will guide you through the process of reconfiguring your macOS keybindings to restore the expected word navigation functionality.
Understanding macOS Keybinding Behavior
macOS handles keybindings differently than other operating systems. The Option
(or Alt
) key is primarily designed to input special characters and diacritics. This is why Option-F
produces 'ƒ' and Option-B
produces '∫'. To change this behavior, we need to override the default system-wide keybindings. This is typically done by creating or modifying a DefaultKeyBinding.dict
file in your user's Library
directory.
flowchart TD A[User Presses Alt-F/B] --> B{macOS Keybinding System} B -->|Default Behavior| C[Input Special Character (ƒ/∫)] B -->|Custom Keybinding Exists| D[Execute Custom Action (Move Word)] D --> E[Cursor Moves Word Forward/Backward]
macOS Keybinding Decision Flow
Creating or Modifying DefaultKeyBinding.dict
The DefaultKeyBinding.dict
file is a property list (plist) file that allows you to customize keybindings for most Cocoa applications on macOS. If this file doesn't exist, you'll need to create it. If it does, you'll add the necessary entries to it. This file should be located in ~/Library/KeyBindings/
.
~/Library
folder is hidden by default. You can access it by opening Finder, holding down the Option
key, and clicking 'Go' in the menu bar, then selecting 'Library'.1. Step 1: Create the KeyBindings Directory
Open Terminal (Applications/Utilities/Terminal.app
) and create the KeyBindings
directory if it doesn't already exist:
2. Step 2: Create or Edit the DefaultKeyBinding.dict File
Use a text editor (like nano
, vim
, or VS Code) to create or edit the DefaultKeyBinding.dict
file. The file should contain the following XML-like structure:
3. Step 3: Apply the Changes
For the changes to take effect, you typically need to restart the applications you want the new keybindings to apply to. For system-wide changes, a full logout/login or reboot might be necessary, though often restarting individual apps is sufficient.
mkdir -p ~/Library/KeyBindings
Command to create the KeyBindings directory
{
"~f": "moveWordForward:",
"~b": "moveWordBackward:"
}
Content for DefaultKeyBinding.dict
to remap Alt-F and Alt-B
DefaultKeyBinding.dict
file, ~
represents the Option
(Alt) key. f
and b
are the keys being pressed. moveWordForward:
and moveWordBackward:
are the Cocoa text system selectors that perform the desired word navigation.Verifying the New Keybindings
After restarting your applications, open a text editor (like TextEdit, Safari's address bar, or any other Cocoa application) and test the Alt-F
and Alt-B
key combinations. Your cursor should now jump forward and backward by words, similar to Emacs or traditional Windows/Linux behavior, instead of printing special characters.