add tab autocompletion for commands

I've added a hook to make 'tab' function as autocomplete for commands.  It matches against the portion of the prompt to the left of the cursor and stores the last match so it can iterate through commands if you hit it repeatedly.