Sample Header Ad - 728x90

Change word separators for text navigation in Terminal

0 votes
0 answers
68 views
This question may already be answered on here somewhere, but I'm unsure what keywords to use for my search. In the Terminal, I frequently navigate around lines using the meta+left or meta+right arrow keys. In most places I do this — emacs, ssh'd into remote computers running bash, even typing in this box — meta+right *doesn't* jump past spaces to the start of the next word. But in the Terminal, running on my macbook, it does. Also, on my computer, these two commands jump past special characters such as *~/!'\".. How can I change this behavior? Or find these settings in a remote computer's bash, and the corresponding ones in my zsh, to help me move them over? Concrete examples of current vs preferred behavior: foo bar 1234567 ↑ cursor at position (1); meta+right arrow; cursor at position 5. I'd prefer the cursor end up at position 4. foo*/ bar 123456789 ↑ cursor at position (1); meta+right arrow; cursor at position 7. I'd prefer the cursor end up at position 4. (My preferred behavior would make another meta+right then jump to position 10, no matter how many special characters are in the */ character block. Meta+left would jump from e.g. position 9 to position 8, then position 1.) I'm running macOS 15.3.1, and using Terminal version 2.14 with zsh.
Asked by Natavi (1 rep)
Mar 4, 2025, 08:07 PM