Question

This is a bit of a weird question, I'll admit, but this is something that really annoys me. I have come to rely on the Emacs shortcuts (mainly ctrl ^+A, ctrl ^+E, ctrl ^+B, and ctrl ^+F) and the behavior of ctrl ^+P and ctrl ^+N is very different than in Emacs. With Emacs, going up a line will ignore soft wrapping and go to the next actual line, not the next displayed line. I've just gotten used to it, I guess. Is there any way to make the Cocoa/Emacs up and down keybindings behave like the real Emacs (preferably only ctrl ^+P and ctrl ^+N, not the arrow keys)?

Was it helpful?

Solution

I don't know any way to do that in DefaultKeyBinding.dict.

For example selectLine: selects a wrapped or visual line and selectParagraph: selects a non-wrapped or hard line, but I couldn't find methods for moving a non-wrapped line up or down.

One thing you can do is to make command-delete and command-forward delete act on non-wrapped lines:

{
  "@\U007F" = deleteToBeginningOfParagraph:;
  "@\UF728" = deleteToEndOfParagraph:;
}

You can't remap command-left or command-right, so for example this doesn't work:

{
  "@\Uf700" = moveToBeginningOfParagraph:;
  "@\Uf701" = moveToEndOfParagraph:;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top