Skip to content

Instantly share code, notes, and snippets.

@v2e4lisp
Created October 17, 2013 12:02
Show Gist options
  • Select an option

  • Save v2e4lisp/7023684 to your computer and use it in GitHub Desktop.

Select an option

Save v2e4lisp/7023684 to your computer and use it in GitHub Desktop.
(defun map-local-key-to-insert-text (&rest key-text-list)
(dolist (key-text key-text-list)
(let ((key (car key-text))
(text (car (cdr key-text))))
(local-set-key (kbd key)
`(lambda ()
(interactive)
(insert ,text))))))
(defun mou ()
"mou style markdown mode shortcut"
(map-local-key-to-insert-text
'("M-1" "# ")
'("M-2" "## ")
'("M-3" "### ")
'("M-4" "#### ")
'("M-5" "##### ")
'("M-6" "###### ")
'("C-l" "* ")
'("C-q" "> ")))
(add-hook 'markdown-mode-hook 'mou)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment