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

zsh autocompletion working, but not for cheat file names #632

Open
sdondley opened this issue Sep 5, 2021 · 6 comments
Open

zsh autocompletion working, but not for cheat file names #632

sdondley opened this issue Sep 5, 2021 · 6 comments
Labels

Comments

@sdondley
Copy link

sdondley commented Sep 5, 2021

Thanks for submitting a bug report. Please provide the following information:

A description of the problem
I have zsh (with ohmyzh). Completions are working for cheat arguments but they are not working for the names of the cheatsheet files.

Example:
cheat tm<tab> does nothing even though a tmux cheat sheet exists in my ~/.config/cheat/cheatsheets/personal directory
cheat -<tab> generates a list of acceptable arguments for the cheat command

cheat version info
4.2.2

@sdondley sdondley added the bug label Sep 5, 2021
@sdondley
Copy link
Author

sdondley commented Sep 5, 2021

OK, so looking at the completion script, there is a $state variable on or about line 45 that never gets set. When I change that $state variable and replace it with 'full', completions for cheat file names start working.

I'm not much of a shell scripter so I'm not quire sure how get the $state variable to reflect the correct context. Maybe the bash script will offer some clues. I'll take a look.

@sdondley
Copy link
Author

sdondley commented Sep 5, 2021

OK, I just made the default value for state to be 'full'. Seems to work.

_cheat() {
  local state
  state='full'

...snip...

Then it get overridden by the _arguments portion of the code. If this is the correct way of fixing this, just let me know and I'll submit a patch.

@amineism
Copy link

amineism commented Oct 20, 2021

Had the same issue, your fix worked, thanks !

@simonjujuh
Copy link

Same problem here. The fix is working but a real fix would be awesome. Thanks for your work :)

@chrisallenlane chrisallenlane added autocompletion shell-integration zsh Pertaining to the `zsh` shell. labels Jul 4, 2022
@jcgutier
Copy link

I have the same problem with autocomplete. We would appreciate a fix. Thanks for this work!!

@bytemain
Copy link

the state variable is generated by the _arguments methods, you can see the The option -C tells _arguments to modify the curcontext parameter for an action of the form ‘->state’.

in this commit:018bce7

someone remove the last line:
CleanShot 2022-09-15 at 14 05 26@2x

but his commit message is Fix ZSH autocompletion

This was referenced Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants