emacs - 让 emacs 向 'ansi-term' 中的程序发送 F<n> 键

标签 emacs

关于如何让 emacs 将未绑定(bind)的 F1..F12 键发送到程序的任何提示,就像在“ansi-term”缓冲区中的常规终端一样?

最佳答案

您正在寻找的不是“解除绑定(bind)”,而是将这些键绑定(bind)到正确的转义序列。下面将 [f1]..[f5] 绑定(bind)到 vt100 转义序列,用于 term 和 ansi-term 缓冲区的那些键。我不确定 ansi 的正确序列是什么,因此相应地调整 alist。

(defun term-send-function-key ()
  (interactive)
  (let* ((char last-input-event)
         (output (cdr (assoc char term-function-key-alist))))
    (term-send-raw-string output)))

(defconst term-function-key-alist '((f1 . "\e[OP")
                                    (f2 . "\e[OQ")
                                    (f3 . "\e[OR")
                                    (f4 . "\e[OS")))

(dolist (spec term-function-key-alist)
  (define-key term-raw-map
    (read-kbd-macro (format "<%s>" (car spec)))
    'term-send-function-key))

关于emacs - 让 emacs 向 'ansi-term' 中的程序发送 F<n> 键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2396680/

相关文章:

emacs - 从 Emacs 在 Markdown 中呈现 unicode 字符

emacs - 在Emacs中禁用鼠标单击

python - Emacs 无法创建与 raw.github.com 的连接(未找到 gzip)

Emacs Magit : how can I see differences between a given branch and unstaged changes?

emacs - 将 CSV 导入组织模式属性

用于 OpenCV C++ 接口(interface)的 Emacs CEDET

emacs - 在 emacs 中移动区域或行

macos - 如何在 zshell 中使用 `M-x` 中的 `emacs -nw`

python - 如何在 emacs 终端中启用 `flymake-display-err-menu-for-current-line`?

emacs - Elisp lambda、引用和 lexical-let