zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.42k stars 1.16k forks source link

Add bash zsh and nu shell completions #3152

Open mmahmoudian opened 4 months ago

mmahmoudian commented 4 months ago

I have added shell completions for Bash, Zsh, and Nushell. I don't use Fish shell and on the first look it looked too complicated. Perhaps can be added in another PR.

This is a Draft PR because I don't know how in your build system these files should be integrated. On a typical linux distro bash should sit in /usr/share/bash-completion/completions/ and should be renamed to micro, for zsh it should sit in /usr/share/zsh/site-functions and should be renamed to _micro.

As for Nushell, the documentation is not clear about the path, so I think we should leave it as is, until a Nushell fan help us with that.

bartekpacia commented 3 months ago

Wow thanks a lot! I love shell completions :-) Did you make it manually, or used some kind of automated tool?

Once this is merged, it's worth updating the package managers to automatically install these completions. For example for Homebrew, an additional statement to install completions should be added to the install method. Examples of this from other tools:

mmahmoudian commented 3 months ago

I manually created those. I don't know of any automated way to generate them, and I don't think such software exist simply because there so many different styles of CLI: