meow 中 esc键

狗哥求助 @DogLooksGood ,为什么在tmux环境下,esc键按下延迟那么多,才能退出插入模式。

这个是不是要在 tmux 中配置

这个延迟是终端下特有的东西,用来输入 Escape sequence 用的,tmux可以用 set -s escape-time 0 修改这个值。meow 是 (setq meow-esc-delay 0)

不知道咋配置,可能是 input-decode-map造成的。我看github讨论里关于jk退出的配置,能非常快速退出插入模式,如下:

(defvar meow-two-char-escape-sequence "jk")
(defvar meow-two-char-escape-delay 0.5)
(defun meow--two-char-exit-insert-state (s)
  "Exit meow insert state when pressing consecutive two keys.

S is string of the two-key sequence."
    (when (meow-insert-mode-p)
    (let ((modified (buffer-modified-p))
          (undo-list buffer-undo-list))
      (insert (elt s 0))
      (let* ((second-char (elt s 1))
             (event
              (if defining-kbd-macro
                  (read-event nil nil)
              (read-event nil nil meow-two-char-escape-delay))))
        (cond
         ((null event) (ignore))
          ((and (integerp event) (char-equal event second-char))
           (backward-delete-char 1)
                (set-buffer-modified-p modified)
                (setq buffer-undo-list undo-list)
                (push 'escape unread-command-events))
          (t (push event unread-command-events)))))))
(defun meow-two-char-exit-insert-state ()
  "Exit meow insert state when pressing consecutive two keys."
  (interactive)
  (meow--two-char-exit-insert-state meow-two-char-escape-sequence))
(define-key meow-insert-state-keymap (substring meow-two-char-escape-sequence 0 1)
  #'meow-two-char-exit-insert-state)

试了下,依然还是有点延迟。

设置了 tmux 的话,应该就没有延迟了。

terminal 本身输入esc也是有延迟的吧,输入esc和输入jk是两回事。

刚才没有关掉,另开了一个测试延迟,结果延迟,现在没事了。

好了,谢了,没有延迟的感觉好多了

可能是 “ESC” 和 “” 的区别?

这个Escape退出和vterm-mode有冲突,vterm-mode下会提示buffer is read-only,不知道你们是怎么解决的