Enable orgtbl-mode in markdown-mode

This makes working with tables much nicer.
This commit is contained in:
Robert O'Connor 2016-09-29 20:25:03 -04:00 committed by d12frosted
parent 6cc0ab89f9
commit 8aa42a0719
No known key found for this signature in database
GPG key ID: 8F60E862D6F5CE8F

View file

@ -48,6 +48,17 @@
:defer t
:config
(progn
;; stolen from http://stackoverflow.com/a/26297700
;; makes markdown tables saner via orgtbl-mode
(require 'org-table)
(defun cleanup-org-tables ()
(save-excursion
(goto-char (point-min))
(while (search-forward "-+-" nil t) (replace-match "-|-"))))
(add-hook 'markdown-mode-hook 'orgtbl-mode)
(add-hook 'markdown-mode-hook
(lambda()
(add-hook 'after-save-hook 'cleanup-org-tables nil 'make-it-local)))
;; Insert key for org-mode and markdown a la C-h k
;; from SE endless http://emacs.stackexchange.com/questions/2206/i-want-to-have-the-kbd-tags-for-my-blog-written-in-org-mode/2208#2208
(defun spacemacs/insert-keybinding-markdown (key)