I don't want remembered commands, I want the terminal to tell me what stuff means. I want it to tell me what makes sense in which context. Like the IntelliSense when coding Java or C#. Docs at your fingertips, all relevant options (and none else) available, etc. This is incomparable to the kind of autocomplete any shell I've seen to date has. Zsh is a nice step in the right direction but it's still shit.
~/.l/share: tar --<tab>
--absolute-paths (Don't strip leading /)
--after-date (Only store newer files)
--append (Append files to archive)
--atime-preserve (Keep access time)
…and 58 more rows
As others have mentioned, zsh can be tuned to perform similarly. fish is nice in that if you don't have explicit completions for options set up it actually parses man pages.Regarding contextual analysis, the fundamental problem is that command execution relies on a list of strings (argv) with no types or meaning. Each command is responsible for parsing its own arguments, either manually or using a shared library (e.g. getopt). This provides loose coupling and flexibility, but makes introspection really difficult, and features like completions become an afterthought reimplemented in every shell either by special cases for each command or hacks like parsing help messages.
for example, i do the following:
anupam@virat ~ % autoload -Uz compinit
anupam@virat ~ % compinit
anupam@virat ~ % git a<TAB>
add -- add file contents to index
am -- apply patches from a mailbox
apply -- apply patch to files and/or to index
archimport -- import an Arch repository into git
archive -- create archive of files from named tree
edit-001: added trivial example.https://i.imgur.com/SZqu63p.png
I'm not sure it covers all of the obscure commands you can think of, but 99% of the time it's great.
Edit: looks like it might be stock behaviour https://github.com/zsh-users/zsh/blob/master/Completion/Unix...