2015-08-01 14:58:51 +00:00
|
|
|
;;; packages.el --- Markdown Layer packages File for Spacemacs
|
2015-02-10 03:13:09 +00:00
|
|
|
;;
|
2020-09-16 21:34:40 +00:00
|
|
|
;; Copyright (c) 2012-2020 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
|
2018-11-20 19:55:37 +00:00
|
|
|
'(
|
|
|
|
company
|
|
|
|
company-emoji
|
|
|
|
emoji-cheat-sheet-plus
|
|
|
|
gh-md
|
|
|
|
markdown-mode
|
|
|
|
markdown-toc
|
|
|
|
mmm-mode
|
2018-11-07 07:56:16 +00:00
|
|
|
org
|
2018-11-20 19:55:37 +00:00
|
|
|
smartparens
|
2021-01-02 19:39:11 +00:00
|
|
|
valign
|
2018-11-20 19:55:37 +00:00
|
|
|
(vmd-mode :toggle (eq 'vmd markdown-live-preview-engine))
|
|
|
|
))
|
2015-02-10 03:13:09 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun markdown/post-init-company ()
|
2017-06-14 14:47:12 +00:00
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
2017-07-07 09:36:03 +00:00
|
|
|
(eval `(spacemacs|add-company-backends
|
|
|
|
:backends company-capf
|
|
|
|
:modes ,mode))))
|
2016-05-30 02:39:21 +00:00
|
|
|
|
|
|
|
(defun markdown/post-init-company-emoji ()
|
2017-06-14 14:47:12 +00:00
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
2017-07-07 09:36:03 +00:00
|
|
|
(eval `(spacemacs|add-company-backends
|
|
|
|
:backends company-emoji
|
|
|
|
:modes ,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
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-09-30 01:41:58 +00:00
|
|
|
:init
|
2017-06-14 14:47:12 +00:00
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"cr" 'gh-md-render-buffer))))
|
2015-09-29 16:40:19 +00:00
|
|
|
|
2021-01-02 19:39:11 +00:00
|
|
|
(defun markdown/post-init-valign ()
|
|
|
|
(add-hook 'markdown-mode-hook 'valign-mode))
|
|
|
|
|
2015-09-08 19:57:19 +00:00
|
|
|
(defun markdown/post-init-smartparens ()
|
|
|
|
(add-hook 'markdown-mode-hook 'smartparens-mode))
|
|
|
|
|
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
|
2020-09-18 17:29:41 +00:00
|
|
|
(("\\.mkd\\'" . markdown-mode)
|
|
|
|
("\\.mdk\\'" . markdown-mode)
|
|
|
|
("\\.mdx\\'" . markdown-mode))
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-02-10 03:13:09 +00:00
|
|
|
:config
|
2015-02-16 22:05:19 +00:00
|
|
|
(progn
|
2021-01-04 20:12:07 +00:00
|
|
|
;; Make markdown-mode behave a bit more like org w.r.t. code blocks i.e.
|
|
|
|
;; use proper syntax highlighting
|
|
|
|
(setq markdown-fontify-code-blocks-natively t)
|
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")
|
2018-03-09 15:18:49 +00:00
|
|
|
("mt" . "markdown/table")
|
|
|
|
("mT" . "markdown/toggle")
|
2015-10-21 12:36:00 +00:00
|
|
|
("mx" . "markdown/text")))
|
2017-06-14 14:47:12 +00:00
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
|
|
|
(spacemacs/declare-prefix-for-mode
|
|
|
|
mode (car prefix) (cdr prefix))))
|
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
|
2018-03-11 01:40:51 +00:00
|
|
|
;; rebind this so terminal users can use it
|
|
|
|
"M-RET" 'markdown-insert-list-item
|
2017-02-13 12:37:13 +00:00
|
|
|
;; Movement
|
|
|
|
"{" 'markdown-backward-paragraph
|
|
|
|
"}" 'markdown-forward-paragraph
|
|
|
|
;; Completion, and Cycling
|
|
|
|
"]" 'markdown-complete
|
|
|
|
;; Indentation
|
|
|
|
">" 'markdown-indent-region
|
2018-07-24 07:23:44 +00:00
|
|
|
"<" 'markdown-outdent-region
|
2017-02-13 12:37:13 +00:00
|
|
|
;; 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
|
2018-07-24 07:23:44 +00:00
|
|
|
"il" 'markdown-insert-link
|
2017-02-13 12:37:13 +00:00
|
|
|
"iw" 'markdown-insert-wiki-link
|
|
|
|
"iu" 'markdown-insert-uri
|
|
|
|
;; Element removal
|
|
|
|
"k" 'markdown-kill-thing-at-point
|
|
|
|
;; List editing
|
|
|
|
"li" 'markdown-insert-list-item
|
2017-06-09 15:21:48 +00:00
|
|
|
;; Toggles
|
2018-03-09 15:18:49 +00:00
|
|
|
"Ti" 'markdown-toggle-inline-images
|
|
|
|
"Tl" 'markdown-toggle-url-hiding
|
|
|
|
"Tm" 'markdown-toggle-markup-hiding
|
|
|
|
"Tt" 'markdown-toggle-gfm-checkbox
|
|
|
|
"Tw" 'markdown-toggle-wiki-links
|
|
|
|
;; Table
|
|
|
|
"tp" 'markdown-table-move-row-up
|
|
|
|
"tn" 'markdown-table-move-row-down
|
|
|
|
"tf" 'markdown-table-move-column-right
|
|
|
|
"tb" 'markdown-table-move-column-left
|
|
|
|
"tr" 'markdown-table-insert-row
|
|
|
|
"tR" 'markdown-table-delete-row
|
|
|
|
"tc" 'markdown-table-insert-column
|
|
|
|
"tC" 'markdown-table-delete-column
|
|
|
|
"ts" 'markdown-table-sort-lines
|
|
|
|
"td" 'markdown-table-convert-region
|
|
|
|
"tt" 'markdown-table-transpose
|
2017-02-13 12:37:13 +00:00
|
|
|
;; region manipulation
|
|
|
|
"xb" 'markdown-insert-bold
|
2018-03-09 15:18:49 +00:00
|
|
|
"xB" 'markdown-insert-gfm-checkbox
|
2017-02-13 12:37:13 +00:00
|
|
|
"xc" 'markdown-insert-code
|
|
|
|
"xC" 'markdown-insert-gfm-code-block
|
2018-03-09 15:18:49 +00:00
|
|
|
"xi" 'markdown-insert-italic
|
2020-02-13 14:01:31 +00:00
|
|
|
"xk" 'markdown-insert-kbd
|
2018-03-09 15:18:49 +00:00
|
|
|
"xp" 'markdown-insert-pre
|
2017-02-13 12:37:13 +00:00
|
|
|
"xq" 'markdown-insert-blockquote
|
2018-03-09 15:18:49 +00:00
|
|
|
"xs" 'markdown-insert-strike-through
|
2017-02-13 12:37:13 +00:00
|
|
|
"xQ" 'markdown-blockquote-region
|
|
|
|
"xP" 'markdown-pre-region
|
|
|
|
;; Following and Jumping
|
|
|
|
"N" 'markdown-next-link
|
|
|
|
"f" 'markdown-follow-thing-at-point
|
|
|
|
"P" 'markdown-previous-link
|
2018-07-24 07:23:44 +00:00
|
|
|
"<RET>" 'markdown-do)
|
2017-06-14 14:47:12 +00:00
|
|
|
(when (eq 'eww markdown-live-preview-engine)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 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
|
2018-06-06 05:15:48 +00:00
|
|
|
(add-hook 'spacemacs-editing-style-hook
|
2021-01-02 19:39:11 +00:00
|
|
|
'spacemacs//markdown-hjkl-promotion-demotion)
|
2018-06-06 05:15:48 +00:00
|
|
|
(spacemacs//markdown-hjkl-promotion-demotion dotspacemacs-editing-style)
|
|
|
|
(define-key markdown-mode-map (kbd "M-<down>") 'markdown-move-down)
|
|
|
|
(define-key markdown-mode-map (kbd "M-<left>") 'markdown-promote)
|
|
|
|
(define-key markdown-mode-map (kbd "M-<right>") 'markdown-demote)
|
|
|
|
(define-key markdown-mode-map (kbd "M-<up>") 'markdown-move-up))))
|
2015-02-10 03:13:09 +00:00
|
|
|
|
|
|
|
(defun markdown/init-markdown-toc ()
|
|
|
|
(use-package markdown-toc
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-06-14 14:47:12 +00:00
|
|
|
:init
|
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 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
|
2018-11-19 12:29:00 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(mapc 'markdown/mmm-auto-class markdown-mmm-auto-modes)
|
|
|
|
(spacemacs|hide-lighter mmm-mode))))
|
2016-06-01 05:53:06 +00:00
|
|
|
|
|
|
|
(defun markdown/init-vmd-mode ()
|
|
|
|
(use-package vmd-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-06-14 14:47:12 +00:00
|
|
|
:init
|
|
|
|
(dolist (mode markdown--key-bindings-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"cP" 'vmd-mode))))
|
2018-11-07 07:56:16 +00:00
|
|
|
|
|
|
|
(defun markdown/post-init-org ()
|
|
|
|
(when (configuration-layer/layer-used-p 'org)
|
|
|
|
(add-hook 'markdown-mode-hook 'orgtbl-mode)
|
|
|
|
(spacemacs|diminish orgtbl-mode)
|
|
|
|
(add-hook 'markdown-mode-hook 'spacemacs//cleanup-org-tables-on-save)))
|