diff options
| author | jixiuf <jixiuf@qq.com> | 2020-11-30 23:21:54 +0800 |
|---|---|---|
| committer | jixiuf <jixiuf@qq.com> | 2020-11-30 23:21:54 +0800 |
| commit | 93053f67268595e9a560fff4a635db51c4e9604f (patch) | |
| tree | bc933568db056b329b927d9c36631e180e982746 | |
| parent | b91edd442882c9f0cf2b905e3ec0f894ab608e2f (diff) | |
bind M-[A-Z] and C-S-[a-z]
| -rw-r--r-- | vterm.el | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -474,13 +474,22 @@ of data. If nil, never delay. The units are seconds.") `(defun ,(intern (format "vterm-send-%s" key))() ,(format "Sends %s to the libvterm." key) (interactive) - (vterm-send-key ,(char-to-string (get-byte (1- (length key)) key)) nil - ,(string-prefix-p "M-" key) - ,(string-prefix-p "C-" key)))) + (vterm-send-key ,(char-to-string (get-byte (1- (length key)) key)) + ,(let ((case-fold-search nil)) + (or (string-match-p "[A-Z]$" key) + (string-match-p "S-" key))) + ,(string-match-p "M-" key) + ,(string-match-p "C-" key)))) (mapc (lambda (key) (eval `(vterm-define-key ,key))) - (cl-loop for prefix in '("C-" "M-") + (cl-loop for prefix in '("M-") + append (cl-loop for char from ?A to ?Z + for key = (format "%s%c" prefix char) + collect key))) + (mapc (lambda (key) + (eval `(vterm-define-key ,key))) + (cl-loop for prefix in '("C-" "M-" "C-S-") append (cl-loop for char from ?a to ?z for key = (format "%s%c" prefix char) collect key)))) @@ -502,7 +511,15 @@ Exceptions are defined by `vterm-keymap-exceptions'." (mapc (lambda (key) (define-key map (kbd key) (intern (format "vterm-send-%s" key)))) - (cl-loop for prefix in '("C-" "M-") + (cl-loop for prefix in '("M-") + append (cl-loop for char from ?A to ?Z + for key = (format "%s%c" prefix char) + unless (member key exceptions) + collect key))) + (mapc (lambda (key) + (define-key map (kbd key) + (intern (format "vterm-send-%s" key)))) + (cl-loop for prefix in '("C-" "M-" "C-S-" ) append (cl-loop for char from ?a to ?z for key = (format "%s%c" prefix char) unless (member key exceptions) |
