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

turn off argument completion #1219

Closed
geekscrapy opened this issue Jul 5, 2022 · 13 comments
Closed

turn off argument completion #1219

geekscrapy opened this issue Jul 5, 2022 · 13 comments
Labels
question Further information is requested

Comments

@geekscrapy
Copy link

Firstly, great tool!

Hi, How can I turn off argument completion? I would prefer filenames/directories to be shown instead.
image

Second question:
I loose some key bindings when I invoke ble.sh. For example I am on a mac (with iterm) and use ALT+DELETE to delete a previous word. This is disabled when I use ble.sh

@rsteube
Copy link
Member

rsteube commented Jul 5, 2022

Flags should only be completed when the current word starts with -. As i understand you are using ble.sh - i had some issues with it overriding the completion on the first [TAB]. The completions in the screenshot are not the ones from carapace.
Don't know about the ALT-DELETE issue (which is related to ble.sh) as i am using elvish myself - maybe @akinomyoga can help.

@rsteube rsteube added the question Further information is requested label Jul 5, 2022
@akinomyoga
Copy link

akinomyoga commented Jul 5, 2022

Re: Filename completions for ls

Hi, How can I turn off argument completion? I would prefer filenames/directories to be shown instead.

@geekscrapy ble.sh combined with bash-completion by default is supposed to generate filenames and directory names for the empty-word completion. The behavior of the picture seems to be different from the default behavior of ble.sh. I would like to know the detailed setup in your environment.

  • Q1 Which version of ble.sh do you use? If you are using ble-0.3, could you instead try ble-0.4? If you are not using the latest version of ble-0.4, could you update it to the latest master by running ble-update?
$ ble-update
  • Q2 What would be shown by pressing [Ctrl+X][Ctrl+V] in a ble.sh session?
$ [press Ctrl+X][press Ctrl+V]
  • Q3 What would be shown when you run the command complete -p ls?
$ complete -p ls

Re: ALT-DELETE in iTerm2

@geekscrapy It depends on the detailed terminal settings about what key sequences the terminal sends for ALT-DELETE. To check the sequence for the present setting, could you tell what would be shown after pressing [Ctrl+V][ALT+DELETE] in a ble.sh session?

$ echo [press Ctrl+V][press ALT+DELETE]     <-- Q. What will be shown?

Also, I'm interested in what would be sent by pressing [Ctrl+V][DELETE]

$ echo [press Ctrl+V][press DELETE]     <-- What will be shown?

Also, you might also want to check the description of ALT in iTerm2 under the item "M-right does not work in my terminal" on the Q&A page.

@akinomyoga
Copy link

akinomyoga commented Jul 5, 2022

Re: Issues with ble.sh on the first [TAB]

i had some issues with it overriding the completion on the first [TAB].

@rsteube Maybe I can try it later when I have time. If there are certain conditions to reproduce it, I'd appreciate it if you could provide the details.

@rsteube
Copy link
Member

rsteube commented Jul 5, 2022

@akinomyoga added ble to the Dockerfile: carapace-sh/carapace#538 .
Seems to work alright now.

edit:
Ah, it seems to be related to the lazy-loading in carapace-bin. So the error should be on my side.

@akinomyoga
Copy link

@rsteube Thanks! I've tried docker-compose run --rm ble, where the completion seems to work fine!

@rsteube
Copy link
Member

rsteube commented Jul 6, 2022

@akinomyoga yes, it happens in this project. Likely related to the two-step registering of completions where i am missing sth.:

_carapace_lazy() {
  source <(carapace $1 bash-ble)
   $"_$1_completion"
}
complete -F _carapace_lazy acpi

@akinomyoga
Copy link

akinomyoga commented Jul 6, 2022

Hmm, I guess

 _carapace_lazy() {
   source <(carapace $1 bash-ble)
-   $"_$1_completion"
+  "_$1_completion_ble" "$@"
 }
 complete -F _carapace_lazy acpi

By the way, I'm not sure if carapace targets Bash 3.2 also, but Bash 3.2 does not support sourcing from pipes, i.e., source <(cmd) doesn't work. Instead, eval -- "$(cmd)" is the option that always works in all the versions of Bash.

 _carapace_lazy() {
-  source <(carapace $1 bash-ble)
+  eval -- "$(carapace "$1" bash-ble)" &&
   "_$1_completion_ble" "$@"
 }
 complete -F _carapace_lazy acpi

@rsteube
Copy link
Member

rsteube commented Jul 6, 2022

Nah, i'm just blind. It's supposed to be:

-   $"_$1_completion"
+   $"_$1_completion_ble"

I'm generally targeting fairly recent versions at the moment. So unless someone really needs it i would stick to that.

@akinomyoga
Copy link

Thanks for the fix!

I'm generally targeting fairly recent versions at the moment. So unless someone really needs it i would stick to that.

OK!

@rsteube
Copy link
Member

rsteube commented Jul 7, 2022

@geekscrapy did you get it working?

@geekscrapy
Copy link
Author

Hi! I'll be able to try it again after the weekend.
RE Q1 @akinomyoga , this was the first time I used ble.sh so I presume it would be up-to-date. I'll check though

(did my original issue get moved from the ble.sh issue list? I'd never heard of carapace before seeing this thread? Or maybe I was overtired 🙃)

@akinomyoga
Copy link

(did my original issue get moved from the ble.sh issue list? I'd never heard of carapace before seeing this thread? Or maybe I was overtired 🙃)

Oh, does it mean you intended to create an issue in ble.sh? This issue was created here from the beginning and has never been moved since then. Maybe you have been opening multiple tabs in the web browser, picked up the wrong one, and created this issue? That might be possible if you have found ble.sh in a page where both ble.sh and carapace are mentioned, such as oils-for-unix/oils#915.

I guess we want to move the issue to ble.sh if possible, but I think it's not possible because there is no user who has the owner privilege or the write access to both repositories.

@rsteube
Copy link
Member

rsteube commented Jul 7, 2022

Probably best to just reopen a new one there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants