Ctrl + A doesn't work in Bash Terminal on OS X Lion

13

4

In bash windows using the Terminal.app on OS X Lion, I can no longer use ctrl + A as a shortcut for going to the start of the command line. Other ctrl characters like ctrl + E don't work any longer either.

Any ideas?

Spig

Posted 2011-07-29T14:29:38.487

Reputation: 313

Answers

14

^A and ^E are commands of bashs "emacs mode". Check your bash settings with

set -o

and verify that emacs is set to on. If your bash is in vi-mode (vi on) then you need to use the vi shortcuts to navigate within the row (ESC to leave insert mode, 0 to go to the beginning and $ to go to the end).

barbaz

Posted 2011-07-29T14:29:38.487

Reputation: 2 696

6You should also note that to switch it back to emacs mode, do set -o emacs – Austin Hyde – 2011-07-29T18:58:19.313

6

If you want your setting to persist between sessions, add the following to your ~/.profile.

set -o vi
set -o emacs

Of course, you should only add one of those two, depending on your preferred editing mode.

jfmercer

Posted 2011-07-29T14:29:38.487

Reputation: 221

1

Check to see the keyboard settings of your current theme. Terminal > Preferences > Settings > Keyboard.

If you don't see what you want in there try making a new theme to see if it works

bswinnerton

Posted 2011-07-29T14:29:38.487

Reputation: 421

In my case it was overwritten with "Bring all windows to front". Maybe any app set that? After removing it works again like a glance. – Markus Zeller – 2016-11-17T17:02:48.240

I just verified, and they do seem to be working on my 10.7 box, so I think it must have something to do with the theme that you're using. – bswinnerton – 2011-07-29T15:12:45.357

Yup. These are the most basic bash shortcuts and should definitely work at least in Bash. There should be no keyboard shortcuts set, actually, so "If you don't see what you want in there" is the default case and nothing to worry about. – slhck – 2011-07-29T15:14:26.793

Mine continues to work after the 10.7 update. Actually works in all apps that i've tested it in... – peelman – 2011-07-29T15:20:26.150

Check your general keyboard shortcuts as well to make sure you don't have anything overwriting your ctrl shortcuts. System Preferences > Keyboard > Keyboard Shortcuts – bswinnerton – 2011-07-29T15:24:21.727