How to delete entire words and lines in OS X

by Kelle on May 24, 2011

Delete keyI’m a big keyboard shortcut kinda gal. In both X11 and Aqua apps like Mailplane, TextMate, and Firefox, I regularly use:

ctrl-k to “kill” an entire line
ctrl-y to “yank” it back
ctrl-a to move to the beginning of a line
ctrl-e to move to the end of a line.

I’ve been in the market for a way to move back by word for awhile. And this Lifehacker article, The Mac OS X Delete Key: It Goes Both Ways, has gotten me a step in the right direction:

fn-delelte to delete text in front of the cursor
option+delete to delete entire word behind cursor. (In X11, entire line.)
cmd-delete to delete entire line of text behind cursor.

I could see these shortcuts being really useful! One snag is that the behavior doesn’t seem to be consistent between X11 and regular Aqua apps.

But, this still doesn’t help me just move back a word. So, does anybody know how to do move back by word in either X11 or Aqua? What are other keyboard shortcuts that you use while working with lines of text? Maybe it’s buried in the official list, Mac OS X keyboard shortcuts, but I don’t see it!

{ 4 comments… read them below or add one }

1 saurav May 24, 2011 at 8:55 am

Aqua: Option + Arrow.
X11/emacs: Meta + f/b

Note that the default meta key is “Esc” in Macs. Also, you have press Meta+f/b, release both keys, and press them again if you want to move two or more words.


2 Dan May 24, 2011 at 8:56 am

I don’t use any X11 apps so I’m not too sure what to do there but in standard Aqua apps, Option-left/right arrow moves you around word by word and Ctrl-left/right arrow moves you to the begininning/end of the line.

The behavior is a little different in TextMate (if I remember correctly) but it should be something similar.

Hope this helps!


3 Ben May 24, 2011 at 11:40 am

If you’re talking about editing command lines in an xterm, that is a shell behavior and the default key bindings are like Emacs editing keys – that’s where Ctrl-a, Ctrl-e, Ctrl-k and so on came from. So, M-f and M-b to move forward/back a word (Meta is usually Escape as stated above). Ctrl-t transposes characters – again an Emacs key binding.

However, only a few of these commands (C-a, C-e, C-k, any others?) will work in a Firefox text entry box.


4 Rodolfo May 24, 2011 at 11:43 am

These keyboard short cuts are general for shell environments. A very nice list is provided at the Wikipedia.

Saludos from the South!



Leave a Comment

Previous post:

Next post: