C-S-DEL(一次性杀死一条线)在我的emacs中不起作用 [英] C-S-DEL (Kill an entire line at once) doesn't work in my emacs
问题描述
这个表示 CS-DEL
绑定到 kill-whole-line
命令,同时杀死整个行。我使用emacs 24.5.1在我的Macbook上尝试过,但是它根本不起作用。然后我使用 C-h k C-S-DEL
来检查当我按这个热键时发生了什么。它表示,除 Ctrl + Shift + DEL
之外,只有 DEL
键被识别。
我通过Homebrew安装这个emacs(版本24.5.1),并在iTerm2中运行。它没有GUI版本(我更喜欢在终端中使用),并且通过 emacs
命令启动。
如何配置我的emacs以支持 CS-DEL
?
这是可能的,但它有点笨蛋。使用Karibinder等工具重新映射 C-S-delete
,同时将终端用于终端接收的密钥序列。您可以使用 Mx describe-unbound-keys
与 unbound.el 找到这样的键。然后,在您的emacs配置中,您应该将这些键重新映射到相应的功能。
以下是如何重新映射 CS-delete的示例通过将它放在您的
private.xml
到 Cx n M- [u
文件。 Karabinder的文档非常好。
< appdef>
< appname> TERMINAL< / appname>
< equal> com.apple.Terminal< / equal>
< / appdef>
< item>
< name>修复C-S删除Emacs< / name>
< identifier> private.m_s_delete_emacs< / identifier>
< only> TERMINAL< / only>
< autogen>
__KeyToKey__
KeyCode :: DELETE,ModifierFlag :: OPTION_L | ModifierFlag :: SHIFT_L,
KeyCode :: X,ModifierFlag :: CONTROL_L,KeyCode :: N,KeyCode :: BRACKET_LEFT,ModifierFlag :: OPTION_L,KeyCode :: U
< / autogen>
< / item>
然后在您的emacs配置中:
(global-set-key(kbdCx n M- [u)'kill-whole-line)
/ pre>
也许有更多的OS X用户喜欢使用终端版本的emacs超过GUI版本。在这种情况下,一个综合的Karbiner&社区可以创建emacs配置,以覆盖使用终端不支持的修饰符的所有键序列。至于还没有这样的事情,我相信,但如果我找到任何东西或创造了某些东西,我会更新我的答案。
This says that
C-S-DEL
is bound tokill-whole-line
command that kills an entire line at once. I tried it on my macbook with emacs 24.5.1, however, it doesn't work at all. I then useC-h k C-S-DEL
to check what happened when I press this hotkey. It says that, onlyDEL
key is recognised other thanCtrl + Shift + DEL
.I install this emacs (version 24.5.1) via Homebrew and run it in iTerm2. It does't have a GUI version (I prefer to use in terminal), and is launched simply via
emacs
command.How can I config my emacs to support
C-S-DEL
?解决方案It is possible, but it is a bit cumberstone. Use a tool like Karibinder to remap
C-S-delete
while using your terminal to a key sequence your terminal does receive. You can useM-x describe-unbound-keys
with unbound.el to find such keys. Then, within your emacs configuration, you should remap those keys to the appropriate functions.Here is an example of how you could remap
C-S-delete
toC-x n M-[ u
with Karibinder by putting it in yourprivate.xml
file. Karabinder's documentation is very good.<appdef> <appname>TERMINAL</appname> <equal>com.apple.Terminal</equal> </appdef> <item> <name>Fix C-S-delete Emacs</name> <identifier>private.m_s_delete_emacs</identifier> <only>TERMINAL</only> <autogen> __KeyToKey__ KeyCode::DELETE, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L, KeyCode::X, ModifierFlag::CONTROL_L, KeyCode::N, KeyCode::BRACKET_LEFT, ModifierFlag::OPTION_L, KeyCode::U </autogen> </item>
And then in your emacs configuration:
(global-set-key (kbd "C-x n M-[ u") 'kill-whole-line)
Perhaps there are more OS X users out there that prefer to use the terminal version of emacs over a GUI version. In that case, a comprehensive Karbiner & emacs configuration may be created by the community to cover all key sequences that use modifiers unsupported by the terminal. As of yet there is no such thing I believe, but I will update my answer if I find anything or if something is created.
这篇关于C-S-DEL(一次性杀死一条线)在我的emacs中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!