logoalt Hacker News

derrizlast Sunday at 11:06 AM5 repliesview on HN

I feel that the ergonomics of bash completion took a hit as the configurations got “smarter” and “helpfully” started blocking file or directory name completion if it thinks it wouldn’t be appropriate to have a file name at the current cursor position. Instead of blocking, the default should always be to fall back to filename completion.

Sometimes I’m close to disabling/uninstalling all completion scripts out of irritation as decades of muscle memory are frustrated by this behavior.

It’s like that bad/annoying UX with text fields where the UI is constantly fighting against you in order prevent you from producing “illegal” intermediate input - e.g. let me paste the clipboard here goddammit - I know what I’m doing - I’ll correct it.


Replies

JNRowelast Sunday at 2:45 PM

There is the complete-filename function that only completes filenames in bash, bound to M-/ by default. You can use that in any place you want a filename where "complete"(the function normally bound to tab) would do something you don't desire.

There are a collection of other non-context aware completion functions that are bound by default too, useful for example when you when you wish to complete hostnames in a for-loop.

zle has what is largely a significant superset of this, the documentation is spread about between the zshzle and zshcomp* manpages.

loeglast Sunday at 1:41 PM

There is one particular command I occasionally use that has totally broken completion for files, so I've taken to just using 'ls X Y Z' to get the right completion behavior and then changing 'ls' to the right command as the last step.

show 1 reply
IshKebablast Sunday at 11:44 AM

I agree that is annoying. It's waaay less confusing to complete a filename and then get an error from the actual program than it is for just ...nothing to happen so you get confused and have to `ls` to check if the file actually exists and it does and so you think tab completion is broken for some reason and you copy & paste the filename and then finally you get the error that explains what is going on.

It should at least print a message like "file foo.exe exists but it isn't executable".

show 1 reply
cryptozlast Sunday at 11:13 AM

I have come to absolutely despise web form inputs with front end email validators that are broken. Input field hints to type your email, so you start typing. As soon as you type the first letter it goes red and says “error!!! Invalid email!”

Unbelievably frustrating.

show 1 reply
compressedgaslast Sunday at 11:43 AM

As it works as desired after running: complete -r; there is something broken about the bash-completion script.