1

control-a is pretty close - it moves the character to the first column. command-left does too.

if my keyboard had a home key this would likely move the cursor there, but it doesn't.

similar to this question, i'm trying to get vim's ^ behaviour without moving my hands too far. unfortunately alt-m outputs µ instead of giving me the goods.

i'm hoping for something i can use system wide, i'm not sure if os x has this though.

3

There is no shortcut for it by default. As a hack, you can create ~/Library/KeyBindings/ and save a property list like this as ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
  "~m" = (moveToBeginningOfParagraph:, insertText:, " ", moveLeft:, selectWord:, 
  moveRight:, setMark:, moveToBeginningOfParagraph:, deleteForward:, 
  swapWithMark:, moveLeft:);
}

Then quit and reopen applications to apply the changes. ~m is option-m, which is bound to back-to-indentation in Emacs.

I copied the macro from https://github.com/ttscoff/KeyBindings/blob/master/DefaultKeyBinding.dict. moveToBeginningOfParagraph:, selectWord:, moveRight: would not work with lines that don't start with spaces or tabs. moveToBeginningOfParagraph:,moveWordRight:, moveWordLeft: would not work with some lines where the first non-whitespace character is a special character.

DefaultKeyBinding.dict does not work with some applications like Xcode or Firefox.

See http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html or http://osxnotes.net/keybindings.html for more information.

  • this is really eye opening - that Customizing the Cocoa Text System article is great – schpet Mar 3 '14 at 6:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .