Delete word under cursor

If you want to delete the entire line, just substitute the key for the ⌥ key, as in:

⌘⌫

Just to put all of this in a compact format, I created the below table for my reference Evernote note, and I thought I'd share it will all of you:

For #5 (delete to the end of line) you have also ⌃K

I'm assuming the shortcuts I posted will work in all apps.
Is this correct?

Options are always good to have and I know some prefer the Emacs bindings. For me, I like to keep it simple, and just use/remember one shortcut per action.

Not all apps use Cocoa controls, so those bindings may not be universal. You would need to test app by app with anything built on, for example, a Webkit substrate.

Apps using CodeMirror and Electron come to mind, for example Atom, FoldingText etc.

I'm not sure I understand your comment.

I was referring to shortcuts like "⌥⌫", NOT the Emacs shortcuts that @Tom referred to.

So are you saying that Mac standard shortcuts like "⌥⌫" work ONLY with Cocoa controls?

Yes - they are only guaranteed to where Cocoa controls are being used.

Key bindings on custom, Webkit, Electron, CodeMirror etc controls are up to the developer and can’t be assumed or predicted. You can only test them to find out. Not all elements of your table will work with all apps. Intersection but not identity.

As @ComplexPoint has pointed out, it depends on the app which key bindings it supports. Some examples:

⌥⌫ fn⌥⌫ ⌘⌫ fn⌘⌫ ⌃K
TextEdit
BBEdit (✓) (✓)
TextMate (✓) (✓)
Xcode (✓) (✓)
Atom (✓) (✓)
Nisus Writer
MS Word (2011)
InDesign (CS6)
‌ Note: fn⌫ is equivalent to ⌦ on extended keyboards.

(✓) means it behaves differently, dependent if soft line wrapping is on or off.

This is interesting, since it gives fn⌘⌫ and ⌃K in BBEdit, TextMate and Xcode a distinct meaning:

  • fn⌘⌫ deletes to the end of the visual (soft-wrapped) line
  • ⌃K deletes to the end of the real line

The behavior of Atom in this respect seems buggy to me.

See the note above about the difference between fn⌘⌫ and ⌃K in BBEdit, TextMate and Xcode.

3 Likes

Thanks for clarifying, and posing the survey. Very helpful.

Most of the non-compliant Apps (like MS Word) have other shortcuts that perform the same function. I suppose one could create a KM Macro to map the standard keystroke to the Word (or other app) keystroke/function.

I don’t use short keys to delete letters or words. String triggers are faster. I use for example, jk to delete the letter behind the character. The string triggers the shortcuts for that. Same goes for deleting a word behind the cursor (jh), or an entire line of text (dlt). I do something similar with BetterTouchTool.