在 Emacs 中,如何使用键盘选择完成列表? [英] In Emacs, how do I select the completion list with the keyboard?
问题描述
当我在 minibuffer 中使用 tab-complete 并且 Emacs 在新缓冲区中显示完成列表时,我如何在不使用鼠标的情况下切换到该缓冲区?
When I tab-complete in a minibuffer and Emacs displays a completion list in a new buffer, how do I switch to that buffer without using the mouse?
我尝试了 C-x o
,但它只是切换到第一个缓冲区,然后我进入了小缓冲区.
I tried C-x o
, but that just switched to the first buffer, out of which I entered the minibuffer.
我也尝试过 C-x b
,但这给了我 command 在 minibuffer 中尝试使用 minibuffer
.
I also tried C-x b
, but that gives me command attempted to use minibuffer while in minibuffer
.
最后我尝试了 C-x <C-right>
,这让我 无法在小缓冲区窗口中切换缓冲区
.
Lastly I tried C-x <C-right>
, which gives me cannot switch buffers in minibuffer window
.
我在示例中谈到了小缓冲区补全,但是能够从常规缓冲区中访问补全列表(使用键盘)对我来说也很重要,但无法正常工作.建议使用 Mv
快捷方式,但它似乎只能在 Mx
访问的微型缓冲区内工作,在我尝试过的所有其他缓冲区中,Mv
绑定到 scroll down command
并且不会切换到完成列表.我什至似乎不在其他迷你缓冲区中工作.例如,它在 M-!
调用的 shell 命令 minibuffer 中也不起作用.
I spoke about minibuffer completion in my example, but being able to access the completion list (using the keyboard) from within a regular buffer is also important to me, and not working. The M-v
shortcut was suggested, but it only seems to work inside the minibuffer accessed by M-x
, in every other buffer I've tried, M-v
is bound to scroll down command
and does not switch to the completion list. I doesn't even seem to work in other minibuffers. For example, it doesn't work in the shell command minibuffer invoked by M-!
either.
推荐答案
您可以使用 Mv(文档化 here) 切换到完成缓冲区并将光标放在第一个完成处:
You can use M-v (documented here) which switches to the completion buffer and puts the cursor on the first completion:
在 minibuffer 中输入 M-v,选择显示完成列表(切换到完成).这为使用铺平了道路下面的命令.
或
做同样的事情.你也可以用其他方式选择窗口...
Typing M-v, while in the minibuffer, selects the window showing the completion list (switch-to-completions). This paves the way for using the commands below.
<PageUp>
or<prior>
does the same. You can also select the window in other ways...
根据您对原始问题的编辑,您所要求的是一种更全局地切换到完成缓冲区的方法.有一个函数 switch-to-completions
可以选择完成列表 - 您可以考虑将该函数绑定到您选择的键,例如:
It looks like based on your edit to the original question that what you're asking for is a way to switch to the completions buffer more globally. There is a function switch-to-completions
that selects the completions list - you might consider binding that function to a key of your choosing, e.g.:
(define-key global-map (kbd "C-x t") 'switch-to-completions)
例如,这样的绑定允许我从 M-! 调用的Shell 命令:"切换到补全,并将光标放在第一个可能的补全上.
For example, such a binding allows me to switch to completions from "Shell command: " invoked by M-!, and places the cursor on the first possible completion.
这篇关于在 Emacs 中,如何使用键盘选择完成列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!