Delete a word in a file

When typing, I want to be able to delete the last word (basically.

That is, wherever the cursor is, delete everything back to the to the last space character. Then I would assign that as “Shift-Delete” or maybe even delete.

If anyone has something like this or some fast guidance on how to accomplish this, I would appreciate it.

1 Like

Option-Backspace doesn’t work?

1 Like

What about SHIFT-OPTION-LEFT ARROW?

Works for me. Thanks Tom, I didn't know about that one.

Option means word: ⌥⌫ deletes the word to the left, ⌥← moves the cursor by one word, ⇧⌥← selects one word.

Command means line: ⌘⌫ deletes to the beginning of the line, ⌘← moves the cursor to the beginning, ⇧⌘← selects from the cursor to the beginning of the line.

This should work at least in all Cocoa apps. Besides that there are a couple of Emacs-style shortcuts. Here is a comprehensive list of text navigation shortcuts.

How did you get the option and delete keys to print like that?

Hey John,

Use keyboard tags in the markdown:

<kbd>⌘←</kbd>

<kbd>⌘</kbd><kbd>←</kbd>

⌘←

-Chris

:-/ ?

Hey John,

I mis-keyed and posted, before I was done. Look now.

-Chris

Ah! Ok. Got it.

Uh… mmm… well you guys can work on how you wanna write it up in the doc… but yeah, Option-Backspace is a winner. Many thanks!

Shift-Upper Arrow will delete a word for me, Shift-Left Arrow will delete each character.

Then you have some macro or key-remapping active. By default Shift + Any Arrow extends the selection.

1 Like

I thought I would comment this morning. I simply remapped “optiion delete” to “shift delete”. The ability to delete previous words or sections of words is fantastic and reliable. (used to do it in WordStar). One of these “it just works” things.

Be warned this could have unintended consequences.
Some apps use SHIFT-DELETE for specific actions. For example, Outlook uses it to permanently delete an item.

1 Like

!! Understood. I get surprised doing these things now and again. But I am all in with Gmail so this particular one I am safe (for now).