Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom vterm-copy-mode-map #537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schellj
Copy link

@schellj schellj commented Jul 12, 2021

Not sure if this is correct or required, but without this change, I haven't been able to figure out a way to apply a customized vterm-copy-mode-map.

@schellj schellj force-pushed the custom-vterm-copy-mode-map-support branch from 91c707b to 2406425 Compare September 30, 2021 19:39
@Sbozzolo
Copy link
Collaborator

Sbozzolo commented Jan 20, 2022

Admittedly, I don't know why we are setting the local map to nil, but if I evaluate the following code:

(defun say-hi ()
  (interactive)
  (message "HI"))

(define-key vterm-copy-mode-map (kbd "C-p C-f") 'say-hi)

C-p C-f correctly prints "HI" to the minibuffer when I am in vterm-copy-mode. Is this what you are trying to achieve?

@schellj
Copy link
Author

schellj commented Jan 20, 2022

@Sbozzolo yes, that method seems to work, thanks.

I also just tested and doing the following in use-package :init works, but not in :config:

  (setq-default vterm-copy-mode-map (let ((map (make-sparse-keymap)))
                              (define-key map (kbd "M-p")      #'vterm-copy-mode)
                              (define-key map [return]         #'vterm-copy-mode)
                              (define-key map (kbd "RET")      #'vterm-copy-mode)
                              (define-key map (kbd "H-c C-r")  #'vterm-reset-cursor-point)
                              (define-key map (kbd "C-a")      #'vterm-beginning-of-line)
                              (define-key map (kbd "C-e")      #'vterm-end-of-line)
                              (define-key map (kbd "H-c C-n")  #'vterm-next-prompt)
                              (define-key map (kbd "H-c C-p")  #'vterm-previous-prompt)
                              (define-key map (kbd "H-c C-f")  #'ffap)
                              map))

I'm fairly certain that I had tried that before and had issues, but I can't seem to reproduce them now. Possibly something changed in emacs-libvterm since July that enabled setting vterm-copy-mode-map in use-package :init to work, not sure.

@jixiuf jixiuf force-pushed the master branch 2 times, most recently from 9a6dbeb to a2f2286 Compare April 14, 2022 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants