gpt4 book ai didi

macos - 为什么 Shift+箭头绑定(bind)在 emacs 终端中的 clojure 模式下不起作用?

转载 作者:行者123 更新时间:2023-12-04 04:30:46 25 4
gpt4 key购买 nike

如果我在终端中运行 emacs(即在 iTerm2 中使用 emacs -nw 启动 emacs)
使用 windmove它是默认绑定(bind),我应该能够使用 Shift 的各种组合在窗口之间导航+ , 还有 paredit具有涉及 Ctrl 的绑定(bind)/Meta + ,这些都在(比如说)elisp模式缓冲区中工作正常。

看起来箭头键功能依赖于 emacs 解码终端转义序列,通过(我认为)input-decode-map
但是,如果我将主模式设置为 clojure-mode那么转义序列的解码似乎被禁用(或覆盖)。当我执行这些绑定(bind)时,我只会得到转义序列。
clojure-mode 中的绑定(bind)发生了什么? ?

版本:

  • emacs 24.3.1(已尝试 maxosxforemacs.com 版本和自制软件)
  • clojure-mode 20131117.2306 (已经尝试过其他版本)
  • OSX 10.8.5
  • iTerm2 1.0.0.20131124

  • (免责声明: I raised this as an issue on clojure-mode, but no solution is forthcoming)

    2013 年 12 月 10 日更新:绝对清楚:这个问题是 clojure-mode 所特有的。 . emacs -nw在 iTerm + 箭头键在其他主要模式下工作正常。我确定我正在做一些愚蠢的事情导致这种情况,我想知道是什么。

    最佳答案

    这里的设置几乎相同,但没有类似的问题。这就是我无论如何都会做的。首先,评估暂存缓冲区中的以下 emacs-lisp 代码。

    (progn
    (define-key input-decode-map "\e[1;2D" [S-left])
    (define-key input-decode-map (kbd "M-[ 1 ; 2 C") [S-right])
    (define-key input-decode-map (kbd "M-[ 1 ; 2 B")[S-down])
    (define-key input-decode-map "\e[1;2A" [S-up])
    (define-key input-decode-map "\e[1;6A" [S-C-up])
    (define-key input-decode-map "\e[1;6B" [S-C-down]))

    激活 clojure-mode 时尝试使用 windmove 绑定(bind)。如果这解决了您的问题,并假设您的 TERM 环境变量设置为 xterm-256color ,将以下内容放入您的 init.el
    (if (equal "xterm-256color" (tty-type)) 
    (progn
    (define-key input-decode-map "\e[1;2D" [S-left])
    (define-key input-decode-map (kbd "M-[ 1 ; 2 C") [S-right])
    (define-key input-decode-map (kbd "M-[ 1 ; 2 B")[S-down])
    (define-key input-decode-map "\e[1;2A" [S-up])
    (define-key input-decode-map "\e[1;6A" [S-C-up])
    (define-key input-decode-map "\e[1;6B" [S-C-down])))

    希望这可以帮助。

    关于macos - 为什么 Shift+箭头绑定(bind)在 emacs 终端中的 clojure 模式下不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20460040/

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