Allow tilde expansion in completion and builtins

Also fixes directory completion when completing a command name.