2015-08-01 14:58:51 +00:00
|
|
|
;;; packages.el --- Markdown Layer packages File for Spacemacs
|
2015-02-10 03:13:09 +00:00
|
|
|
;;
|
2017-01-06 03:51:13 +00:00
|
|
|
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
|
2015-02-10 03:13:09 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq markdown-packages
|
2015-02-10 03:13:09 +00:00
|
|
|
'(
|
2016-05-30 02:39:21 +00:00
|
|
|
company
|
|
|
|
company-emoji
|
2015-08-27 01:55:28 +00:00
|
|
|
emoji-cheat-sheet-plus
|
2015-09-29 16:40:19 +00:00
|
|
|
gh-md
|
2015-02-10 03:13:09 +00:00
|
|
|
markdown-mode
|
|
|
|
markdown-toc
|
2015-05-06 23:28:17 +00:00
|
|
|
mmm-mode
|
2015-09-08 19:57:19 +00:00
|
|
|
smartparens
|
2016-06-14 10:39:38 +00:00
|
|
|
(vmd-mode :toggle (eq 'vmd markdown-live-preview-engine))
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2015-02-10 03:13:09 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun markdown/post-init-company ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends :backends company-capf :modes markdown-mode))
|
2016-05-30 02:39:21 +00:00
|
|
|
|
|
|
|
(defun markdown/post-init-company-emoji ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends company-emoji
|
|
|
|
:modes markdown-mode))
|
2016-05-30 02:39:21 +00:00
|
|
|
|
2015-08-27 01:55:28 +00:00
|
|
|
(defun markdown/post-init-emoji-cheat-sheet-plus ()
|
|
|
|
(add-hook 'markdown-mode-hook 'emoji-cheat-sheet-plus-display-mode))
|
|
|
|
|
2015-09-29 16:40:19 +00:00
|
|
|
(defun markdown/init-gh-md ()
|
|
|
|
(use-package gh-md
|
2015-09-30 01:41:58 +00:00
|
|
|
:defer t
|
|
|
|
:init
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'markdown-mode
|
|
|
|
"cr" 'gh-md-render-buffer)))
|
2015-09-29 16:40:19 +00:00
|
|
|
|
2015-09-08 19:57:19 +00:00
|
|
|
(defun markdown/post-init-smartparens ()
|
|
|
|
(add-hook 'markdown-mode-hook 'smartparens-mode))
|
|
|
|
|
2016-07-15 08:43:17 +00:00
|
|
|
;; from Jason Blevins http://jblevins.org/log/mmm
|
2016-07-15 11:58:59 +00:00
|
|
|
(defun markdown/mmm-auto-class (lang)
|
|
|
|
(let* ((l (if (listp lang) (car lang) lang))
|
|
|
|
(s (if (listp lang) (cadr lang) lang))
|
|
|
|
(class (intern (concat "markdown-" l)))
|
|
|
|
(submode (intern (concat s "-mode")))
|
|
|
|
(front (concat "^```" l "[\n\r]+"))
|
|
|
|
(back "^```$"))
|
2016-07-15 08:28:33 +00:00
|
|
|
(mmm-add-classes (list (list class
|
|
|
|
:submode submode
|
|
|
|
:front front
|
|
|
|
:back back)))
|
|
|
|
(mmm-add-mode-ext-class 'markdown-mode nil class)))
|
|
|
|
|
2015-02-10 03:13:09 +00:00
|
|
|
(defun markdown/init-markdown-mode ()
|
|
|
|
(use-package markdown-mode
|
2017-05-23 09:00:09 +00:00
|
|
|
:mode
|
|
|
|
(("\\.m[k]d" . markdown-mode)
|
|
|
|
("\\.mdk" . markdown-mode))
|
2015-02-10 03:13:09 +00:00
|
|
|
:defer t
|
|
|
|
:config
|
2015-02-16 22:05:19 +00:00
|
|
|
(progn
|
2016-09-30 00:25:03 +00:00
|
|
|
(add-hook 'markdown-mode-hook 'orgtbl-mode)
|
2017-05-18 16:20:05 +00:00
|
|
|
(add-hook 'markdown-mode-hook 'spacemacs//cleanup-org-tables-on-save)
|
2015-10-21 12:36:00 +00:00
|
|
|
;; Declare prefixes and bind keys
|
|
|
|
(dolist (prefix '(("mc" . "markdown/command")
|
|
|
|
("mh" . "markdown/header")
|
|
|
|
("mi" . "markdown/insert")
|
|
|
|
("ml" . "markdown/lists")
|
|
|
|
("mx" . "markdown/text")))
|
|
|
|
(spacemacs/declare-prefix-for-mode
|
|
|
|
'markdown-mode (car prefix) (cdr prefix)))
|
2017-02-13 12:37:13 +00:00
|
|
|
;; note: `gfm-mode' is part of `markdown-mode.el' so we can define its key
|
|
|
|
;; bindings here
|
2017-05-08 02:02:03 +00:00
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
2017-02-13 12:37:13 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
;; Movement
|
|
|
|
"{" 'markdown-backward-paragraph
|
|
|
|
"}" 'markdown-forward-paragraph
|
|
|
|
;; Completion, and Cycling
|
|
|
|
"]" 'markdown-complete
|
|
|
|
;; Indentation
|
|
|
|
">" 'markdown-indent-region
|
|
|
|
"<" 'markdown-exdent-region
|
|
|
|
;; Buffer-wide commands
|
|
|
|
"c]" 'markdown-complete-buffer
|
|
|
|
"cc" 'markdown-check-refs
|
|
|
|
"ce" 'markdown-export
|
|
|
|
"cm" 'markdown-other-window
|
|
|
|
"cn" 'markdown-cleanup-list-numbers
|
|
|
|
"co" 'markdown-open
|
|
|
|
"cp" 'markdown-preview
|
|
|
|
"cv" 'markdown-export-and-preview
|
|
|
|
"cw" 'markdown-kill-ring-save
|
|
|
|
;; headings
|
|
|
|
"hi" 'markdown-insert-header-dwim
|
|
|
|
"hI" 'markdown-insert-header-setext-dwim
|
|
|
|
"h1" 'markdown-insert-header-atx-1
|
|
|
|
"h2" 'markdown-insert-header-atx-2
|
|
|
|
"h3" 'markdown-insert-header-atx-3
|
|
|
|
"h4" 'markdown-insert-header-atx-4
|
|
|
|
"h5" 'markdown-insert-header-atx-5
|
|
|
|
"h6" 'markdown-insert-header-atx-6
|
|
|
|
"h!" 'markdown-insert-header-setext-1
|
|
|
|
"h@" 'markdown-insert-header-setext-2
|
|
|
|
;; Insertion of common elements
|
|
|
|
"-" 'markdown-insert-hr
|
|
|
|
"if" 'markdown-insert-footnote
|
|
|
|
"ii" 'markdown-insert-image
|
|
|
|
"ik" 'spacemacs/insert-keybinding-markdown
|
|
|
|
"iI" 'markdown-insert-reference-image
|
|
|
|
"il" 'markdown-insert-link
|
|
|
|
"iL" 'markdown-insert-reference-link-dwim
|
|
|
|
"iw" 'markdown-insert-wiki-link
|
|
|
|
"iu" 'markdown-insert-uri
|
|
|
|
;; Element removal
|
|
|
|
"k" 'markdown-kill-thing-at-point
|
|
|
|
;; List editing
|
|
|
|
"li" 'markdown-insert-list-item
|
|
|
|
;; region manipulation
|
|
|
|
"xb" 'markdown-insert-bold
|
|
|
|
"xi" 'markdown-insert-italic
|
|
|
|
"xc" 'markdown-insert-code
|
|
|
|
"xC" 'markdown-insert-gfm-code-block
|
|
|
|
"xq" 'markdown-insert-blockquote
|
|
|
|
"xQ" 'markdown-blockquote-region
|
|
|
|
"xp" 'markdown-insert-pre
|
|
|
|
"xP" 'markdown-pre-region
|
|
|
|
;; Following and Jumping
|
|
|
|
"N" 'markdown-next-link
|
|
|
|
"f" 'markdown-follow-thing-at-point
|
|
|
|
"P" 'markdown-previous-link
|
|
|
|
"<RET>" 'markdown-jump))
|
2016-06-07 03:39:41 +00:00
|
|
|
(when (eq 'eww markdown-live-preview-engine)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'markdown-mode
|
|
|
|
"cP" 'markdown-live-preview-mode))
|
2015-04-14 20:36:02 +00:00
|
|
|
;; Header navigation in normal state movements
|
2015-04-13 08:09:50 +00:00
|
|
|
(evil-define-key 'normal markdown-mode-map
|
|
|
|
"gj" 'outline-forward-same-level
|
|
|
|
"gk" 'outline-backward-same-level
|
|
|
|
"gh" 'outline-up-heading
|
|
|
|
;; next visible heading is not exactly what we want but close enough
|
2015-05-08 03:06:38 +00:00
|
|
|
"gl" 'outline-next-visible-heading)
|
2015-04-14 20:36:02 +00:00
|
|
|
;; Promotion, Demotion
|
2015-04-13 08:09:50 +00:00
|
|
|
(define-key markdown-mode-map (kbd "M-h") 'markdown-promote)
|
2015-05-08 03:06:38 +00:00
|
|
|
(define-key markdown-mode-map (kbd "M-j") 'markdown-move-down)
|
|
|
|
(define-key markdown-mode-map (kbd "M-k") 'markdown-move-up)
|
2015-04-13 08:09:50 +00:00
|
|
|
(define-key markdown-mode-map (kbd "M-l") 'markdown-demote))))
|
2015-02-10 03:13:09 +00:00
|
|
|
|
|
|
|
(defun markdown/init-markdown-toc ()
|
|
|
|
(use-package markdown-toc
|
2017-02-09 21:48:56 +00:00
|
|
|
:defer t
|
|
|
|
:init (spacemacs/set-leader-keys-for-major-mode 'markdown-mode
|
|
|
|
"it" 'markdown-toc-generate-toc)))
|
2015-05-06 23:28:17 +00:00
|
|
|
|
|
|
|
(defun markdown/init-mmm-mode ()
|
|
|
|
(use-package mmm-mode
|
2016-12-19 15:45:41 +00:00
|
|
|
:commands mmm-mode
|
|
|
|
:init (add-hook 'markdown-mode-hook 'spacemacs/activate-mmm-mode)
|
2017-05-01 16:51:10 +00:00
|
|
|
;; Automatically add mmm class for languages
|
|
|
|
:config (mapc 'markdown/mmm-auto-class markdown-mmm-auto-modes)))
|
2016-06-01 05:53:06 +00:00
|
|
|
|
|
|
|
(defun markdown/init-vmd-mode ()
|
|
|
|
(use-package vmd-mode
|
|
|
|
:defer t
|
2016-06-07 03:39:41 +00:00
|
|
|
:init (spacemacs/set-leader-keys-for-major-mode 'markdown-mode
|
|
|
|
"cP" 'vmd-mode)))
|