doomemacs/modules/lang/text/config.el
2017-02-20 00:26:07 -05:00

52 lines
1.5 KiB
EmacsLisp

;;; lang/text/config.el
(@def-package markdown-mode
:mode ("\\.m\\(d\\|arkdown\\)$" "/README$"
("/README\\.md$" . gfm-mode))
:init
(setq markdown-enable-wiki-links t
markdown-enable-math t
markdown-italic-underscore t
markdown-make-gfm-checkboxes-buttons t
markdown-gfm-additional-languages '("sh"))
:config
(@add-hook markdown-mode
(auto-fill-mode +1)
(setq line-spacing 2
fill-column 70))
(sp-local-pair
'(markdown-mode gfm-mode)
"\`\`\`" "\`\`\`" :post-handlers '(("||\n" "RET")))
(@set :electric-chars "+" "#")
(@map :map gfm-mode-map "`" 'self-insert-command)
(@map :map markdown-mode-map
"<backspace>" nil
"<M-left>" nil
"<M-right>" nil
"M-*" 'markdown-insert-list-item
"M-b" 'markdown-insert-bold
"M-i" 'markdown-insert-italic
"M-`" '+text/markdown-insert-del
;; Assumes you have a markdown renderer plugin in chrome
:nv "M-r" ( (doom-open-with "Google Chrome"))
;; TODO: Make context sensitive
:n "[p" 'markdown-promote
:n "]p" 'markdown-demote
:i "M--" 'markdown-insert-hr
(:localleader
:nv "i" 'markdown-insert-image
:nv "l" 'markdown-insert-link
:nv "L" 'markdown-insert-reference-link-dwim
:nv "b" 'markdown-preview)))
(@def-package markdown-toc
:after markdown-mode)
(@def-package rst ; built-in
:mode ("\\.re?st$" . rst-mode)
:config (@set :builder '(rst-mode rst-compile-pdf-preview)))