dundalek / closh

Bash-like shell based on Clojure
Eclipse Public License 1.0
1.62k stars 67 forks source link

Tab completion #6

Closed lenw closed 6 years ago

lenw commented 7 years ago

Having intelligent tab completion would be great 🥇

dundalek commented 7 years ago

Definitely on the list.

yubrshen commented 7 years ago

To me, tab completion is the top priority. Without it, it's really hard to use.

dundalek commented 7 years ago

Here is a overview how to approach this:

1) Tab-based autocompletions

First step and quickest way to get to autocompletions is to integrate existing defitions from fish, zsh, bash. I've already done some experiments on that: https://github.com/dundalek/commandray/tree/master/vendor

2) Fish-like auto-suggestions as you type

Once we have autocompletions we can improve the experience by implementing fish-like auto-suggestions as you type.

From https://github.com/fish-shell/fish-shell/issues/3567 :

Keep in mind that fish has two distinct mechanisms: auto-suggestions and completions. The former is based on you command history. The latter on a combination of auto-generated or hand crafted completion commands plus auto-generated pathnames.

For inspiration this is a plugin for auto-suggestions for zsh.

3) Autocompletion menu

Next step is to show visual menu where multiple suggestion can be displayed and user can navigate to choose. I like the visual style of autocomplete as seen in gitsome.

Parsing manual pages

As a bonus for the future we can try to parse manual pages to enable autocompletion for unknown or custom commands. I've opened a separate issue for that.

dundalek commented 7 years ago

Another cool enhancement would be to offer suggestions from tldr.

dundalek commented 6 years ago

Closing this as the initial tab completion has been implemented. Further improvements are tracked in: https://github.com/dundalek/closh/issues/40