How to delete entire words and lines in OS X

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… add one
  • saurav May 24, 2011 @ 8:55

    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.

  • Dan May 24, 2011 @ 8:56

    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!

  • Ben May 24, 2011 @ 11:40

    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.

  • Rodolfo May 24, 2011 @ 11:43

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

    http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29

    Saludos from the South!

    Rodolfo

Leave a Reply

Your email address will not be published. Required fields are marked *