You can use Emacs. Emacs is primarily an editor, but it also includes many related features that let you benefit from the Emacs's capabilities when doing things other than editing files. One of these features is Shell mode, where you edit a command with Emacs then press ⏎ Enter to run it.
You can download Emacs from Emacs For Mac OS X or from package managers such as Homebrew, MacPorts or Fink.
Emacs has its own editing commands that are completely different from Mac's, but at least the Emacs For Mac OS X comes with the standard Mac commands predefined.
To start Emacs and just use it to run a shell:
emacs -e shell -e delete-other-windows
See the Manual for shell-related commands such as navigating history. You can also use F1 m to see a list of key bindings that apply specifically to Shell mode.
Shell mode gives you Emacs's command line editing and infinite scrollback. It does have some downsides: full-screen terminal applications won't work, and you only get basic filename completion rather than context-sensitive completion. Shell mode supports colored output, but applications might not be able to detect it, for example /bin/ls
doesn't (you can trick it with alias ls='TERM=xterm-256color ls -G'
).
Exiting the shell doesn't close Emacs, because using Emacs only to run a shell is unusual. It would be possible to set it up so that exiting the shell exits Emacs if it's not doing anything else, but that would be material for a separate question on Emacs SE.
Alternatively, you may prefer Term to Shell. Term is a full-blown terminal emulator. This means that Emacs transmits most key presses to the underlying shell. For example, ⇥ Tab invokes the shell's completion mechanism. However, Emacs keeps handling some commands internally, in particular all ⌘ Command bindings such as copy-paste. Also, Control+C invokes Term mode commands. On the other hand, Shift+arrow is sent to the shell. It would be possible to have Emacs handle it, but that's not straightforward given that it would de-synchronize the cursor position between Emacs and the shell. I don't know if there's an Emacs package out there that solves this.
If all you want is mouse support and Shift+arrow, there are zsh plugins for that:
Unfortunately neither handles copying the selection to the clipboard with ⌘C. The command Meta+W (Meta is usually ⌥ option, but it depends on your terminal configuration) copies to zsh's own clipboard. See [zsh copy and paste like emacs](See https://unix.stackexchange.com/questions/51933/zsh-copy-and-paste-like-emacs) for how to synchronize zsh's clipboard with the system.
bash
, it has extensive keybinding support through thereadline
library.