微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

正则表达式 – 如何在“迷你缓冲区”模式图中重新定义一个键?

我正在尝试重新定义用于导航历史的键,这些键用于接受正则表达式并提供C-p / C-n历史导航的几个命令.除了C-p / C-n之外,我还想使用其他键.例如,当使用occurrence或replace- regexp时,可以使用C-p和C-n转到上一个和下一个元素.

我已经尝试了几件事,但无法使其发挥作用.我想我在这里错过了“大局”.

我需要修改哪种模式图,何时以及如何修改?我试过的一切都失败了.

P.S:请注意,我已经有了自己的次要模式,我的所有键盘图都在这里建议.

我假设你只需要miniuffer-local-map.使用先前分配给该键映射的键的后续定义将胜过先前的定义.要禁用先前的键分配,只需创建一个新定义并将最后一部分设置为nil而不是’function-name.
(define-key minibuffer-local-map (kbd "<f6>") 'help-for-help)

以下是Emacs Trunk的摘录… / lisp / bindings.el:

(let ((map minibuffer-local-map))
  (define-key map "\en"   'next-history-element)
  (define-key map [next]  'next-history-element)
  (define-key map [down]  'next-history-element)
  (define-key map [XF86Forward] 'next-history-element)
  (define-key map "\ep"   'prevIoUs-history-element)
  (define-key map [prior] 'prevIoUs-history-element)
  (define-key map [up]    'prevIoUs-history-element)
  (define-key map [XF86Back] 'prevIoUs-history-element)
  (define-key map "\es"   'next-matching-history-element)
  (define-key map "\er"   'prevIoUs-matching-history-element)
  ;; Override the global binding (which calls indent-relative via
  ;; indent-for-tab-command).  The alignment that indent-relative tries to
  ;; do doesn't make much sense here since the prompt messes it up.
  (define-key map "\t"    'self-insert-command)
  (define-key map [C-tab] 'file-cache-minibuffer-complete))

原文地址:https://www.jb51.cc/regex/356603.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐