Skip to content

Commit

Permalink
Org markdown: Improve consistency of key bindings for markup language
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaulik authored and syl20bnr committed May 8, 2015
1 parent 3870c30 commit 7b6678e
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 43 deletions.
2 changes: 1 addition & 1 deletion contrib/lang/markdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To generate a table of contents type on top of the buffer:

Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>SPC m "</kbd> | insert hr
<kbd>SPC m -</kbd> | insert hr
<kbd>SPC m a l</kbd> | insert link
<kbd>SPC m a L</kbd> | insert reference link dwim
<kbd>SPC m a u</kbd> | insert uri
Expand Down
77 changes: 41 additions & 36 deletions contrib/lang/markdown/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,46 @@
(sp-local-pair 'markdown-mode "'" nil :actions nil))
(progn
(evil-leader/set-key-for-mode 'markdown-mode
;; Element insertion
"m\"" 'markdown-insert-hr
"mal" 'markdown-insert-link
"maL" 'markdown-insert-reference-link-dwim
"mau" 'markdown-insert-uri
"maf" 'markdown-insert-footnote
"maw" 'markdown-insert-wiki-link
;; Insertion of common elements
"m-" 'markdown-insert-hr
"mil" 'markdown-insert-link
"miL" 'markdown-insert-reference-link-dwim
"miu" 'markdown-insert-uri
"mif" 'markdown-insert-footnote
"miw" 'markdown-insert-wiki-link
"mii" 'markdown-insert-image
"miI" 'markdown-insert-reference-image
"mth" 'markdown-insert-header-dwim
"mtH" 'markdown-insert-header-setext-dwim
"mt1" 'markdown-insert-header-atx-1
"mt2" 'markdown-insert-header-atx-2
"mt3" 'markdown-insert-header-atx-3
"mt4" 'markdown-insert-header-atx-4
"mt5" 'markdown-insert-header-atx-5
"mt6" 'markdown-insert-header-atx-6
"mt!" 'markdown-insert-header-setext-1
"mt@" 'markdown-insert-header-setext-2
"mss" 'markdown-insert-bold
"mse" 'markdown-insert-italic
"msc" 'markdown-insert-code
"msb" 'markdown-insert-blockquote
"msB" 'markdown-blockquote-region
"msp" 'markdown-insert-pre
"msP" 'markdown-pre-region
;; headings
"mhh" 'markdown-insert-header-dwim
"mhH" 'markdown-insert-header-setext-dwim
"mh1" 'markdown-insert-header-atx-1
"mh2" 'markdown-insert-header-atx-2
"mh3" 'markdown-insert-header-atx-3
"mh4" 'markdown-insert-header-atx-4
"mh5" 'markdown-insert-header-atx-5
"mh6" 'markdown-insert-header-atx-6
"mh!" 'markdown-insert-header-setext-1
"mh@" 'markdown-insert-header-setext-2
;; text manipulation
"mtb" 'markdown-insert-bold
"mti" 'markdown-insert-italic
"mtc" 'markdown-insert-code
"mtq" 'markdown-insert-blockquote
"mtQ" 'markdown-blockquote-region
"mtp" 'markdown-insert-pre
"mtP" 'markdown-pre-region
;; Element removal
"mk" 'markdown-kill-thing-at-point
;; Promotion, Demotion, Completion, and Cycling
"m=" 'markdown-promote
"m-" 'markdown-demote
"m]" 'markdown-complete
;; Following and Jumping
"mo" 'markdown-follow-thing-at-point
"mj" 'markdown-jump
"m <RET>" 'markdown-jump
;; Indentation
"m>" 'markdown-indent-region
"m<" 'markdown-exdent-region
;; Header navigation
"mn" 'outline-next-visible-heading
"mp" 'outline-previous-visible-heading
"mf" 'outline-forward-same-level
"mb" 'outline-backward-same-level
"mu" 'outline-up-heading
;; Buffer-wide commands
"mc]" 'markdown-complete-buffer
"mcm" 'markdown-other-window
Expand All @@ -83,16 +79,25 @@
"mcc" 'markdown-check-refs
"mcn" 'markdown-cleanup-list-numbers
;; List editing
"mlk" 'markdown-move-up
"mlj" 'markdown-move-down
"mlh" 'markdown-promote
"mll" 'markdown-demote
"mli" 'markdown-insert-list-item
;; Movement
"m{" 'markdown-backward-paragraph
"m}" 'markdown-forward-paragraph
"mN" 'markdown-next-link
"mP" 'markdown-previous-link))))
"mP" 'markdown-previous-link)

;; normal state movements
(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
"gl" 'outline-next-visible-heading
)
(define-key markdown-mode-map (kbd "M-k") 'markdown-move-up)
(define-key markdown-mode-map (kbd "M-j") 'markdown-move-down)
(define-key markdown-mode-map (kbd "M-h") 'markdown-promote)
(define-key markdown-mode-map (kbd "M-l") 'markdown-demote))))

(defun markdown/init-markdown-toc ()
(use-package markdown-toc
Expand Down
44 changes: 38 additions & 6 deletions contrib/org/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@
"a" nil "ma" 'org-agenda
"c" nil "mA" 'org-archive-subtree
"o" nil "mC" 'evil-org-recompute-clocks
"l" nil "ml" 'evil-org-open-links
"t" nil "mt" 'org-show-todo-tree)
"l" nil "m <RET>" 'evil-org-open-links
"t" nil "mT" 'org-show-todo-tree)
(evil-define-key 'normal evil-org-mode-map
"O" 'evil-open-above

This comment has been minimized.

Copy link
@trishume

trishume May 11, 2015

Contributor

I used this a lot to open new headings from normal mode, what should I be using instead now that this is gone?

This comment has been minimized.

Copy link
@syl20bnr

syl20bnr via email May 12, 2015

Owner
)
(spacemacs|diminish evil-org-mode "" " e"))))

(defun org/init-org ()
Expand All @@ -53,20 +56,43 @@
'(spacemacs|hide-lighter org-indent-mode))
(setq org-startup-indented t)

(defmacro spacemacs|org-emphasize (fname char)
"Make function for setting the emphasize in org mode"
`(defun ,fname () (interactive)
(org-emphasize ,char))
)
(evil-leader/set-key-for-mode 'org-mode
"mc" 'org-capture
"md" 'org-deadline
"me" 'org-export-dispatch
"mf" 'org-set-effort
"mi" 'org-clock-in
"mI" 'org-clock-in
"mj" 'helm-org-in-buffer-headings
"mo" 'org-clock-out
"mm" 'org-ctrl-c-ctrl-c
(concat "m" dotspacemacs-major-mode-leader-key) 'org-ctrl-c-ctrl-c
"mn" 'org-narrow-to-subtree
"mN" 'widen
"mO" 'org-clock-out
"mq" 'org-clock-cancel
"mr" 'org-refile
"ms" 'org-schedule)
"mS" 'org-schedule
;; headings
"mhh" 'org-insert-heading-after-current
"mhH" 'org-insert-heading
;; insertion of common elements
"mil" 'org-insert-link
"mif" 'org-footnote-new
;; images and other link types have no commands in org mode-line
;; could be inserted using yasnippet?
;; text manipulation
"mtb" (spacemacs|org-emphasize spacemacs/org-bold ?*)
"mti" (spacemacs|org-emphasize spacemacs/org-italic ?/)
"mtc" (spacemacs|org-emphasize spacemacs/org-code ?~)
"mtu" (spacemacs|org-emphasize spacemacs/org-underline ?_)
"mtv" (spacemacs|org-emphasize spacemacs/org-verbose ?=)
"mts" (spacemacs|org-emphasize spacemacs/org-strike-through ?+)
"mt <SPC>" (spacemacs|org-emphasize spacemacs/org-clear ? )
)

(eval-after-load "org-agenda"
'(progn
Expand All @@ -81,7 +107,13 @@
(progn
(require 'org-indent)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda))))
(define-key global-map "\C-ca" 'org-agenda)
(evil-leader/set-key
"Cc" 'org-capture
)
))

)

(defun org/init-org-bullets ()
(use-package org-bullets
Expand Down

0 comments on commit 7b6678e

Please sign in to comment.