0

I run zsh in multi-term. M-p and M-n allow me to jump through the input history.

Is there a way to make M-p and M-n behave like up-line-or-beginning-search and down-line-or-beginning-search (jumping only through entries which start with the already input characters)?

1 Answer 1

0

Try:

(with-eval-after-load "term"
  (defun term-send-M-p ()
    "Type M-p in `term-mode'."
    (interactive)
    (term-send-raw-string "\ep"))

  (defun term-send-M-n ()
    "Type M-n in `term-mode'."
    (interactive)
    (term-send-raw-string "\en"))

  (define-key term-raw-map (kbd "M-p") #'term-send-M-p)
  (define-key term-raw-map (kbd "M-n") #'term-send-M-n))

I think multi-term binds M-p and M-n to term-send-up and term-send-down by default, which tries to do the same as pressing the arrows in a terminal. IIRC, multi-term has an elaborate binding override mechanism, which you may have to use instead of plain define-key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.