Skip to content

Instantly share code, notes, and snippets.

@edward
Created September 25, 2013 17:49
Show Gist options
  • Select an option

  • Save edward/6703348 to your computer and use it in GitHub Desktop.

Select an option

Save edward/6703348 to your computer and use it in GitHub Desktop.
Keyboard mapping things for OSX
Something that's bugged me about OS X's Terminal is its default key shortcuts: the home and end keys don't do what I expect, and holding ctrl+arrow keys don't skip around words (which is really useful once you get in the hang of it). Even "cmd" from Windows has these key behaviors. The fix: Check out /etc/inputrc and /etc/profile to make changes system-wide (of course, you can make this specfic to only your user account by using ~/.inputrc and ~/.bash_profile). This is my /etc/inputrc:
# Be 8 bit clean.
set input-meta on
set output-meta on
set convert-meta off
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert
# mappings for "page up" and "page down" to step to the beginning/end
# of the history
"\e[5~": beginning-of-history
"\e[6~": end-of-history
# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward
# this lets you hit tab to auto-complete a file or
# directory name ignoring case
set completion-ignore-case On
# these allow you to use ctrl+left/right arrow keys
# to jump the cursor over words
"\e[5C": forward-word
"\e[5D": backward-word
and this is the relevant line in /etc/profile
export INPUTRC=/etc/inputrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment