emacs - [control shift up]不起作用 [英] emacs - [control shift up] doesn't work
问题描述
我试图定义热键如下
(global-set-key [(control shift up)] 'other-window)
但它不工作(没有错误,只是不工作),也不
but it doesn't work (no error, just doesn't work), neither does
(global-set-key [(control shift down)] 'other-window)
但是
(global-set-key [(control shift right)] 'other-window)
$ b
和
and
(global-set-key [(control shift left)] 'other-window)
work!
但是由于emacs使用了最后两个组合(默认情况下),所以我
But because the last two key combinations are used by emacs (as default), I don't wanna change them for other functions.
那么我怎么可以让 control-shift-up 和控制转移工作?
So how could I make control-shift-up and control-shift-down work?
我已经google了(控制向上移动),似乎 control-shift-up 被其他人(但不是很少的结果)。
I have googled "(control shift up)", it seems that control-shift-up is used by other people, (but not very few results).
推荐答案
这样做的原因不是Emacs的问题,而是来自于您的终端无法生成CS的密钥序列-up。
The reason for this is not an Emacs problem, but comes from the fact that your terminal cannot produce a key sequence for C-S-up.
您可以很容易地验证。打开一个终端,然后键入:
You can verify this very easily. Open a terminal and then type:
Control-v Control-Shift-right
Control-v部分将使下一个键的控制顺序逐字插入到您的shell中。在我们的例子中,它会插入Control-Shift的顺序,这样就可以这样:
The Control-v part will make the control sequence for the next key be inserted verbatim into your shell. In our case, it will insert the sequence for Control-Shift right, and that'll look something like this:
^[[1;6C
现在,为CS-up尝试相同的东西:
Now, try the same thing for C-S-up:
Control-v Control-Shift-up
您将看到没有输入控制序列,这暗示了当您在Emacs中按下CS-up时,实际上从来没有收到任何内容,因为终端无法产生任何传递到Emacs。
You'll see that no control sequence is entered, which hints at the fact that when you press C-S-up in Emacs, it will actually never receive anything, because the terminal is not able to produce anything to pass on to Emacs.
如果您刚刚开始新的 emacs -nw
并键入 Ch k
来调用Emacs的 describe-key
函数。你会在minibuffer中询问键入一个键,看看它绑定了什么功能。如果你现在键入CS-up什么也没有发生 - 当然不是,因为您的Emacs运行的终端不产生任何东西。
We can double-verify this if you just start a new emacs -nw
and type C-h k
to invoke Emacs' describe-key
function. You'll get asked in the minibuffer to type a key to see what function it is bound to. If you now type C-S-up nothing happens - of course not, since the terminal in which your Emacs runs doesn't produce anything.
但是,如果你只是寻找一个未使用的组合键,不用控制就可以进行Shift-up(甚至Shift-right)呢?那个应该在终端emacs和窗口版本中工作。
However, if you're just looking for an unused key-combination, how about just Shift-up (or even Shift-right) without Control? That one should work both in a terminal emacs and in the windowed version.
这篇关于emacs - [control shift up]不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!