Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion files #476

Open
2 of 3 tasks
exploide opened this issue Oct 20, 2019 · 6 comments
Open
2 of 3 tasks

Autocompletion files #476

exploide opened this issue Oct 20, 2019 · 6 comments

Comments

@exploide
Copy link
Contributor

exploide commented Oct 20, 2019

Glad to see the new release of cheat, thanks for all the work! I'm sure it will be at least as useful as the previous version :)

I noticed there are no more autocompletion files on the current master branch. I really valued the tab completion for cheatsheets in the past. This gets especially interesting when package maintainers start packaging cheat v3.

I assume completions for the most widely used shells are needed:

@chrisallenlane
Copy link
Member

chrisallenlane commented Oct 20, 2019

Yeah, shell completion is one of my higher priorities now, and for the shells you've listed. I need to read up on how to implement this properly, but I agree that this is a priority.

I also plan on investigating how we can use fzf and rg or ag for fuzzy real-time searching. I really like even the simple fzf integration implemented already, and I'm interested in taking it further.

@chrisallenlane
Copy link
Member

The 3.5.0 release implemented improved bash autocompletions, and provided a much-improved fzf integration.

That being the case, I'm going to remove the "priority" label from this ticket for now. bash support is currently excellent, fish support is pretty good, and I think bash completions can be used in a zsh context.

If that assertion is untrue, I welcome PRs from zsh users. I have minimal experience with zsh personally.

@chrisallenlane
Copy link
Member

Actually, I'm just going to close this ticket.

I did some further research, and am convinced that zsh users can benefit from the bash autocompletions. Amusingly, I also know that this can be done with cheat specifically, as this article used cheat in its example 😄

https://computingforgeeks.com/how-to-source-bash-completion-script-file-in-zsh/

@roachsinai
Copy link
Contributor

Actually, I'm just going to close this ticket.

I did some further research, and am convinced that zsh users can benefit from the bash autocompletions. Amusingly, I also know that this can be done with cheat specifically, as this article used cheat in its example

https://computingforgeeks.com/how-to-source-bash-completion-script-file-in-zsh/

Method above not work for me on Manjaro, konsole, zsh.

Settings:

hmank ~ » cat ~/.zshrc | head -2            
autoload bashcompinit
bashcompinit
hmank ~ » cat ~/.zshrc | tac | head -1      
source /usr/share/bash-completion/completions/cheat
hmank ~ » 

Get error:

hmank ~ » ct vim_cheat:3: command not found: _init_completion
_cheat:3: command not found: _init_completion
_cheat:3: command not found: _init_completion
ct

@digsim
Copy link

digsim commented Jul 3, 2020

This can be fixed by adding the following snippet on top of the cheat.bash file

_init_completion()
{
    COMPREPLY=()
    _get_comp_words_by_ref cur prev words cword
}

@nerd190
Copy link

nerd190 commented Jan 29, 2021

Hi! thank you for cheat its awesome!
Unfortunately, completions do not work in Termux, I am sometimes away from my PC and would like to look up answers, it says "unsupported os: android". As your binary will run on Android, with or without Termux (same for 'fzf') perhaps "android" should be added as a supported OS? 90% of Android phones nowadays are aarch64 (ARM), the other 10% are x86 (Intel). Thank you again for cheat, it is appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants