Closed 836454543 closed 2 years ago
Maybe you are trying to find the Init File and New Commands sections in the documentation?
Maybe you are looking for the clink-select-complete
command?
If those aren't what you're looking for, then please describe what you mean by "windows style completion".
What do you want to happen?
What do you mean by "old-menu-complete
will show possible completion, which I don't want"?
(I would have described old-menu-complete
as the closest thing to "Windows style completion", since it behaves exactly like Tab in cmd.exe without Clink.)
I'm sorry for my poor description.
old-menu-complete
complete like Windows style, but it will list all possible completions above the current line just like Bash style. The cmd.exe just complete word, it will not display all possible completions above the current line. That is what I want.
I think you are saying:
complete
command).I'm not sure if I understand accurately, though.
I think you are looking for the clink-select-complete
command, as I mentioned earlier.
Have you tried that?
Is this what you want?
You want Tab
to do bash-like completion (the complete command).---------------------Yes Yes Yes
You want Alt+Q
to do a different kind of completion------------------------------Yes Yes Yes
old-menu-complete
do this. clink-select-complete
--------------I konw it. It like PSReadLine. I set Ctrl+Space
to do this.
Thanks for your patient answer.
- You want it to list all possible completions.-----------------------------------NO NO NO! I don't need it, but
old-menu-complete
do this.
No, old-menu-complete
never lists anything. It is the same as Tab in plain cmd.exe without Clink.
- with the next option from the list of possible completions.------------------------NO NO NO!!!!!
That sounds like it contradicts the previous statement.
Here is an animated GIF file of how old-menu-complete
works:
Can you paste your entire .inputrc
file here?
Maybe there is something else later in the file that's interfering?
My .inputrc
file
set completion-ignore-case on
set show-all-if-ambiguous on
set colored-completion-prefix on
set colored-stats on
set bell-style none
set editing-mode emacs
# ↑
"\e[A": history-search-backward
# ↓
"\e[B": history-search-forward
# alt + z
"\ez": undo
# alt + q
"\eq": old-menu-complete
# alt + Q
"\eQ": old-menu-complete-backward
"\t": complete
# ctrl + l,清除一整行内容
"\C-l": kill-whole-line
$if bash
# cmd风格的操作
# ctrl + ←
"\e[1;5D": backward-word
# ctrl + →
"\e[1;5C": forward-word
# Cmder中的alt + del
"\e[3;3~": backward-kill-word
# MobaXterm中的alt + del
"\e\e[3~": backward-kill-word
# ctrl + home
"\e[1;5H": unix-line-discard
# ctrl + end
"\e[1;5F": kill-line
$endif
$if clink
# 每次查询历史指令时,光标跳到指令的最末尾
set history-point-at-end-of-anchored-search on
# 跳转到父目录
"\ep": clink-up-directory
# ctrl + space选择补全
"\e[27;5;32~": clink-select-complete
"\C-z": undo
"\C-y": redo
"\C-a": beginning-of-line
"\C-e": end-of-line
# alt + `设为文本%USERPROFILE%的快捷键,方便输入
"\e`": "%USERPROFILE%"
$endif
My clink set
:
Using the .inputrc
file you shared, I can reproduce the problem.
The cause is this line:
set show-all-if-ambiguous on
The purpose of that Readline option is to always list all the matches if there is more than one match. See Init File Syntax in the Readline manual.
Removing that line will make Alt+q behave as desired.
I imagine you have the line there because you want the complete
command to always immediately list matches.
Readline doesn't seem to have a way to simultaneously configure the two commands to each work how you prefer.
You might try this line instead, though:
set completion-query-items -1
(I agree that it seems like strange behavior in Readline. And the menu-complete
behavior makes even less sense when show-all-if-ambiguous
is on -- if you haven't typed anything yet and invoke menu-complete
then it only lists all and never cycles through completions at all. You might want to report these issues to the bash and Readline maintainers -- these issues will occur in bash as well. But, based on code here and here, it looks like these are both very intentional behaviors.)
Hi, I'm confused about it now. Although I used to bash style, I sometimes want to use windows style completion. I try to do this
clink set clink.default_bindings bash
set .inputrc file"\eq": old-menu-complete
and"\eQ": old-menu-complete-backward
old-menu-complete
will show possible completion, which I don't want. How can I makealt+q
just like windows style completion?