Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  complete -r
disables Bash 'smart tab completion', which in theory is a great idea ( use tab to complete arguments or only list files applicable to the program ) but which never seems to work properly for me.

Disabling it saves a lot of frustrated tab-banging.



Something is terribly wrong with your setup if command line completion is not working.


A lot of installs come with over-complete smart completion configurations that make <tab> take several seconds (or even 10s of seconds) to complete in fairly common situations.


I've had this, but could never be bothered to track down exactly what was causing it (but one thing was ubuntu looking up unknown commands using apt-cache).

I think I "solved" it by ensuring I'd correctly typed the start of what I wanted before hitting tab. Which is better and faster anyway. It fixed me...


Ubuntu's `command-not-found` is terrible but it does not affect bash-completion. CNF runs after you have told bash to execute a command. Tab completion is before you tell bash to run the command.


Well it sure did in mine! Probably a different config from your version (10.04 netbook).

BTW: Ahem. Good sir, I know what tab completion is. I've even added to it for some of my scripts (nothing fancy though).


Please give me one or two examples of "fairly common situations" where it takes >=20 seconds for bash to respond to the tab.


Filename completion on remote systems using ssh/scp. It is a fairly common situation for me, although I wouldn’t say it takes 20s. Maybe 2-5s?


Setting up SSH multiplexing with ControlPersist[1] can help quite a bit here, since after the first connection you don't have to go through the init/connection phase for subsequent completions.

You can even preemptively fire up a master connection to commonly accessed hosts to avoid the initial delay.

[1] https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing


Ah, that’s interesting! I assumed that something like that was going on, as subsequent completions take much shorter (in the same command), but I did not know about preemptively connecting to common hosts.

Thank you very much, I’ll try to play around with it :)


When you are working on a networked filesystem, and someone else has foobared it by doing something stupid.


it regularly happens when I want to expand ~username to /home/username


If It takes 20 seconds for bash to convert `~` to `/home/` something is terribly wrong with your system.


I'm guessing either they are using nis (which it often takes 20s for a passwd lookup) or they have done ~foo/<Tab> which needs to list the home directory; large home directorys on networks can easily take 20s for list.

Neither of those is what I was talking about though, as they aren't really part of the smart complete. To answer your question, I don't have an example, I just know that I tried ubuntu a while ago and smart complete would hang all the time. I don't currently have an ubuntu machine, so I can't try to track it down.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: