gpt4 book ai didi

emacs - 在 Emacs 中以特定模式设置快捷键(例如 ido)

转载 作者:行者123 更新时间:2023-12-04 23:07:54 28 4
gpt4 key购买 nike

我有两个问题,我认为它们有些相关:

1) 在 IDO 中,我想将 ido-restrict-to-matches 更改为 C-SPC 或 C-@ 以外的其他内容。不幸的是,我不知道如何告诉 emacs 我想要一个不同的快捷方式(比如 C-0)。

2)我想保护我的C-;但只要 flyspell-mode 运行,它就会超过 C-;。我的定义在 .emacs 中为:

(global-set-key (kbd "C-;") 'mark-paragraph)

但显然 flyspell 覆盖了这个......(尽管即使那样,如果我查看帮助 M-h k C-;它确实说 mark-paragraph )

有人可以告诉我如何在这些条件下绑定(bind)/取消绑定(bind)键吗?它必须在不修改 ido.el 和 flyspell.el 并重新构建的情况下工作,对吗?

非常感谢!

最佳答案

Flyspell 为 C-; 提供自定义绑定(bind),所以你可以M-x customize RET flyspell-auto-correct-binding RET或在您的 ~/.emacs 中添加类似的内容:

(setq flyspell-auto-correct-binding (kbd "C-~")) ; or a binding of your choice

至于 ido ,您的问题有点令人困惑,因为这意味着有时您在迷你缓冲区之外使用 ido ......

ido.el 中的文档包含以下建议:
;; To modify the keybindings, use the ido-setup-hook.  For example:
;;(add-hook 'ido-setup-hook 'ido-my-keys)
;;
;;(defun ido-my-keys ()
;; "Add my keybindings for ido."
;; (define-key ido-completion-map " " 'ido-next-match)
;; )

使用这些知识,您可以在自己的“ido-my-keys”函数中更改这样的键绑定(bind):
(define-key ido-completion-map (kbd "C-SPC") nil)
(define-key ido-completion-map (kbd "C-@") nil)
(define-key ido-completion-map (kbd "C-0") 'ido-restrict-to-matches)

还有一个额外的 ido 钩子(Hook)专门用于 minibuffer,但不清楚为什么需要它: ido-minibuffer-setup-hook .

关于emacs - 在 Emacs 中以特定模式设置快捷键(例如 ido),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6617507/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com