Skip to content

Instantly share code, notes, and snippets.

@martialboniou
Forked from remvee/*scratch*
Created November 11, 2011 15:35
Show Gist options
  • Save martialboniou/1358281 to your computer and use it in GitHub Desktop.
Save martialboniou/1358281 to your computer and use it in GitHub Desktop.
bind f1, f2, f3 and f4 in emacs term
(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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment