Today I learned how to fix an issue with Ctrl+left and Ctrl+right not working in the new Python REPL on MacOS.

Ctrl+left and Ctrl+right not working in the Python REPL on MacOS

The (new) Python REPL (3.13+) has many useful keyboard shortcuts and two of them are Ctrl+left and Ctrl+right, which are used to navigate the cursor by skipping to the beginning/end of words, as the GIT below shows:

Animation showing how ctrl+left and ctrl+right work on the Python REPL, jumping around words.
GIF showing the keybindings in action.

On MacOS, the keybindings were not working at all. With the help of the new REPL trace functionality, we found out they weren't even making it to Python!

After lots of digging, we found out what the issue was: MacOS was hijacking the two keybindings Ctrl+left and Ctrl+right for spaces-related shortcuts. To turn those off, go to Settings > Keyboard Shortcuts > Mission Control > Mission Control dropdown > Untick “Move left a space” and “Move right a space”.

Turning off the MacOS settings that hijack the keybidings to jump words on the Python REPL.

Become a better Python 🐍 developer 🚀

+35 chapters. +400 pages. Hundreds of examples. Over 30,000 readers!

My book “Pydon'ts” teaches you how to write elegant, expressive, and Pythonic code, to help you become a better developer. >>> Download it here 🐍🚀.

Previous Post Next Post

Blog Comments powered by Disqus.