Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Add one-key keyboard macro bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
eproxus committed Apr 5, 2011
1 parent 23c6c8b commit 555d065
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion keyconfig.el
Expand Up @@ -84,6 +84,9 @@
(global-set-key (kbd "S-<delete>") 'nuke-line) ; Delete the whole line with Shift-DEL
(global-set-key (kbd "S-<kp-delete>") 'nuke-line) ; Delete the whole line with Shift-DEL (OS X)

(global-set-key (kbd "C-D") 'call-last-kbd-macro) ; Run macro
(global-set-key (kbd "C-S-D") 'toggle-kbd-macro-recording-on) ; Start/stop macro

;;; === Custom functions =====================================================

(defun duplicate-current-line ()
Expand Down Expand Up @@ -164,4 +167,18 @@
buffer-files-list)
(find-file
(if arg (nth arg recently-killed-list)
(car recently-killed-list)))))
(car recently-killed-list)))))

(defun toggle-kbd-macro-recording-on ()
"One-key keyboard macros: turn recording on."
(interactive)
(define-key global-map (this-command-keys)
'toggle-kbd-macro-recording-off)
(start-kbd-macro nil))

(defun toggle-kbd-macro-recording-off ()
"One-key keyboard macros: turn recording off."
(interactive)
(define-key global-map (this-command-keys)
'toggle-kbd-macro-recording-on)
(end-kbd-macro))

0 comments on commit 555d065

Please sign in to comment.