Let's say I have a block of text like My website iss https://www.example.com/123/456█, where represents where my cursor is.

In vim, I could just hit B (as opposed to b) to go back a WORD (as opposed to a word), getting me to My website iss █https://www.example.com/123/456 in one movement - where I can easily fix the typo in is.

But in regular mac text boxes, there's no easy way to do this. I can move to the previous word with Option + Left Arrow. Doing this 6 times works:

  • https://www.example.com/123/456█
  • https://www.example.com/123/█456
  • https://www.example.com/█123/456
  • https://www.example.█com/123/456
  • https://www.█example.com/123/456
  • https://█www.example.com/123/456
  • █https://www.example.com/123/456

Or I can move the cursor to the beginning of the current line with Command + Left Arrow. (And then move back to the right if I overshot). But neither are as good as being able to do what I want to do. Consider / and . as part of the "word" movement when doing option + arrow.

Any recommendations?

  • See this answer on Unix & Linux for moving the cursor to the next whitespace and this answer on Stack Overflow for modifying vim key bindings. I don’t use vim so I can only point you in a direction of an answer. If you get an answer please post it and ping me…I’m happy to up vote.
    – Allan
    Commented Apr 18, 2023 at 17:07
  • @Allan Thanks for the help, but I think you misunderstood me. I know how to do it in vim. I even know how to do it in terminal (although now I use zsh with vim-like keybindings). I do NOT know how to do the movements I want in a regular text box, like, say, in slack or in a comment textbox in firefox while on stackexchange. Commented Apr 18, 2023 at 18:20
  • Ok…I think we’re on the same page now. This is going to be App dependent. Those Emacs keybindings pretty much work everywhere so long as it uses the Cocoa Text System. See this answer for further details: apple.stackexchange.com/a/378543/119271
    – Allan
    Commented Apr 18, 2023 at 18:28
  • Thanks - the Cocoa Text System. It looks like there are a bunch of pre-baked commands, but not the one I am looking for. developers.apple.com/library/archive/documentation/Cocoa/… - another relevant link: apple.stackexchange.com/questions/16135/… and ss64.com/osx/syntax-keybindings.html - which has a TON of stuff Commented Apr 19, 2023 at 19:42
  • All of the possible actions that we can invoke using keybindings.dict are here: developer.apple.com/documentation/appkit/… - and this is linked on that ss64 site. I will update here with my progress when I get through all of the reading I have to do! Commented Apr 19, 2023 at 19:44


You must log in to answer this question.

Browse other questions tagged .