Jump to content

Improve Tab Completion in Mac OS X Terminal


Leon
 Share

Recommended Posts

  • Administrators

Mirror of: http://osxdaily.com/2012/08/02/improve-tab-completion-in-mac-os-x-terminal/

 

Tab completion is a wonderful feature of shells that make power users lives easier, letting you automatically complete commands, paths, file names, and a variety of other things entered into the command line. It works great as is but you can make it even better by enabling a few features; ignore caps lock and casing of commands when completing, remove the necessity to double-tap the Tab key if something is ambiguous, and last but certainly not least, cycle through a menu of all possibilities rather than dumping a humungous list if there is ambiguity.

 

If you don’t regularly use the OS X Terminal (or a linux terminal) you probably don’t have a use for this tip.

 

Launch Terminal and be in the home directory to get started:

 

Using emacs, nano, vi, or whatever your favorite text editor is to edit .inputrc, we’ll use nano for the walkthrough:

 

nano .inputrc

 

Paste in the following three rules on unique lines:

 

set completion-ignore-case on
set show-all-if-ambiguous on
TAB: menu-complete

 

Hit Control+O to save changes to .inputrc followed by control+X to quit

Open a new Terminal window or tab, or type “login” to open a new session with the rules in effect

Start typing a command, path, or something else and hit the Tab key to see the improvements firsthand

This has been tested to work with bash shell and should work with any version of Mac OS X. If you enjoyed this, don’t miss our other command line tips and tricks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...