Use evil-org from MELPA
This commit is contained in:
parent
6bf310f572
commit
c533605df0
|
@ -18,15 +18,16 @@
|
|||
- [[#project-support][Project support]]
|
||||
- [[#mode-line-support][Mode line support]]
|
||||
- [[#key-bindings][Key bindings]]
|
||||
- [[#org][Org]]
|
||||
- [[#starting-org-mode][Starting org-mode]]
|
||||
- [[#toggles][Toggles]]
|
||||
- [[#org-mode][Org-mode]]
|
||||
- [[#org-with-evil-org-mode][Org with evil-org-mode]]
|
||||
- [[#tables][Tables]]
|
||||
- [[#trees][Trees]]
|
||||
- [[#element-insertion][Element insertion]]
|
||||
- [[#links][Links]]
|
||||
- [[#emphasis][Emphasis]]
|
||||
- [[#navigating-in-calendar][Navigating in calendar]]
|
||||
- [[#tables][Tables]]
|
||||
- [[#trees][Trees]]
|
||||
- [[#element-insertion][Element insertion]]
|
||||
- [[#links][Links]]
|
||||
- [[#emphasis][Emphasis]]
|
||||
- [[#navigating-in-calendar][Navigating in calendar]]
|
||||
- [[#capture-buffers-and-src-blocks][Capture buffers and src blocks]]
|
||||
- [[#org-agenda][Org agenda]]
|
||||
- [[#keybindings][Keybindings]]
|
||||
|
@ -40,7 +41,7 @@
|
|||
This layer enables [[http://orgmode.org/][org mode]] for Spacemacs.
|
||||
|
||||
** Features:
|
||||
- Vim inspired key bindings are provided by [[https://github.com/edwtjo/evil-org-mode][evil-org-mode]]
|
||||
- Vim inspired key bindings are provided by [[https://github.com/Somelauw/evil-org-mode][evil-org-mode]]
|
||||
- Nicer bullet via [[https://github.com/sabof/org-bullets][org-bullets]]
|
||||
- A [[https://cirillocompany.de/pages/pomodoro-technique][pomodoro method]] integration via [[https://github.com/lolownia/org-pomodoro][org-pomodoro]]
|
||||
- Presentation mode via [[https://github.com/rlister/org-present][org-present]]
|
||||
|
@ -245,7 +246,7 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
#+END_SRC
|
||||
|
||||
* Key bindings
|
||||
** Org
|
||||
** Starting org-mode
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------|
|
||||
|
@ -270,10 +271,11 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
|-------------+-----------------------------------------------|
|
||||
| ~SPC m T i~ | org-toggle-inline-images |
|
||||
| ~SPC m T t~ | org-show-todo-tree |
|
||||
| ~SPC m T T~ | org-todo |
|
||||
| ~SPC m T V~ | toggle =space-doc-mode= a read-only view mode |
|
||||
| ~SPC m T x~ | org-preview-latex-fragment |
|
||||
|
||||
** Org with evil-org-mode
|
||||
** Org-mode
|
||||
|
||||
| Key Binding | Description |
|
||||
|----------------------------------------------+----------------------------------------------|
|
||||
|
@ -305,7 +307,24 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
| ~SPC m C-S-k~ | org-shiftcontrolup |
|
||||
| ~SPC s j~ | spacemacs/jump-in-buffer (jump to a heading) |
|
||||
|
||||
*** Tables
|
||||
** Org with evil-org-mode
|
||||
|
||||
Please see the [[https://github.com/Somelauw/evil-org-mode/blob/master/doc/keythemes.org][evil-org documentation]] for additional instructions on customizing
|
||||
=evil-org-mode=.
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+---------------------------------|
|
||||
| ~gj~ / ~gk~ | Next/previous element (heading) |
|
||||
| ~gh~ / ~gl~ | Parent/child element (heading) |
|
||||
| ~gH~ | Root heading |
|
||||
| ~ae~ | Element text object |
|
||||
| ~ar~ | Subtree text object |
|
||||
| ~M-j~ / ~M-k~ | Move heading |
|
||||
| ~M-h~ / ~M-l~ | Promote or demote heading |
|
||||
| ~M-J~ / ~M-K~ | Move subtree |
|
||||
| ~M-H~ / ~M-L~ | Promote or demote subtree |
|
||||
|
||||
** Tables
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+----------------------------------------------------------------------------|
|
||||
|
@ -337,7 +356,7 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
| ~SPC m t t o~ | Toggle the display of Row/Column numbers in tables |
|
||||
| ~SPC m t w~ | Wrap several fields in a column like a paragraph |
|
||||
|
||||
*** Trees
|
||||
** Trees
|
||||
|
||||
| Key Binding | Description |
|
||||
|-------------+--------------------------------------------|
|
||||
|
@ -378,7 +397,7 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
| ~SPC m s s~ | show sparse tree |
|
||||
| ~SPC m s S~ | sort trees |
|
||||
|
||||
*** Element insertion
|
||||
** Element insertion
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+----------------------------------|
|
||||
|
@ -396,13 +415,13 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
| ~SPC m i s~ | org-insert-subheading |
|
||||
| ~SPC m i t~ | org-set-tags |
|
||||
|
||||
*** Links
|
||||
** Links
|
||||
|
||||
| Key Binding | Description |
|
||||
|-------------+-------------------|
|
||||
| ~SPC m x o~ | org-open-at-point |
|
||||
|
||||
*** Emphasis
|
||||
** Emphasis
|
||||
|
||||
| Key Binding | Description |
|
||||
|-------------+----------------------------|
|
||||
|
@ -414,7 +433,7 @@ To permanently enable mode line display of org clock, add this snippet to your
|
|||
| ~SPC m x u~ | make region underline |
|
||||
| ~SPC m x v~ | make region verbose |
|
||||
|
||||
*** Navigating in calendar
|
||||
** Navigating in calendar
|
||||
|
||||
| Key Binding | Description |
|
||||
|-------------+--------------------|
|
||||
|
|
|
@ -38,3 +38,9 @@
|
|||
(defun spacemacs//surround-code ()
|
||||
(let ((dname (read-from-minibuffer "" "")))
|
||||
(cons (format "#+BEGIN_SRC %s" (or dname "")) "#+END_SRC")))
|
||||
|
||||
|
||||
|
||||
(defun spacemacs//evil-org-mode ()
|
||||
(evil-org-mode)
|
||||
(evil-normalize-keymaps))
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
;;; evil-org.el --- evil keybindings for org-mode
|
||||
|
||||
;; Copyright (C) 2012-2014 by Edward Tjörnhammar
|
||||
;; Author: Edward Tjörnhammar
|
||||
;; URL: https://github.com/edwtjo/evil-org-mode.git
|
||||
;; Package-Version: 20150513.1610
|
||||
;; Git-Repository; git://github.com/edwtjo/evil-org-mode.git
|
||||
;; Created: 2012-06-14
|
||||
;; Version: 0.1.1
|
||||
;; Package-Requires: ((evil "0") (org "0"))
|
||||
;; Keywords: evil vim-emulation org-mode key-bindings presets
|
||||
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Known Bugs:
|
||||
;; See, https://github.com/edwtjo/evil-org-mode/issues
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'evil)
|
||||
(require 'org)
|
||||
|
||||
(define-minor-mode evil-org-mode
|
||||
"Buffer local minor mode for evil-org"
|
||||
:init-value nil
|
||||
:lighter " EvilOrg"
|
||||
:keymap (make-sparse-keymap) ; defines evil-org-mode-map
|
||||
:group 'evil-org)
|
||||
|
||||
(add-hook 'org-mode-hook 'evil-org-mode) ;; only load with org-mode
|
||||
|
||||
(defun clever-insert-item ()
|
||||
"Clever insertion of org item."
|
||||
(if (not (org-in-item-p))
|
||||
(insert "\n")
|
||||
(org-insert-item))
|
||||
)
|
||||
|
||||
(defun evil-org-eol-call (fun)
|
||||
"Go to end of line and call provided function.
|
||||
FUN function callback"
|
||||
(end-of-visible-line)
|
||||
(funcall fun)
|
||||
(evil-append nil)
|
||||
)
|
||||
|
||||
;; recompute clocks in visual selection
|
||||
(evil-define-operator evil-org-recompute-clocks (beg end type register yank-handler)
|
||||
:keep-visual t
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(progn
|
||||
(message "start!" )
|
||||
(save-excursion
|
||||
(while (< (point) end)
|
||||
(org-evaluate-time-range)
|
||||
(next-line)
|
||||
(message "at position %S" (point))
|
||||
))))
|
||||
|
||||
;; open org-mode links in visual selection
|
||||
(defun evil-org-generic-open-links (beg end type register yank-handler incog)
|
||||
(progn
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(catch 'break
|
||||
(while t
|
||||
(org-next-link)
|
||||
;;; break from outer loop when there are no more
|
||||
;;; org links
|
||||
(when (or
|
||||
(not (< (point) end))
|
||||
(not (null org-link-search-failed)))
|
||||
(throw 'break 0))
|
||||
|
||||
(if (not (null incog))
|
||||
(let* ((new-arg
|
||||
;;; if incog is true, decide which incognito settings to
|
||||
;;; use dependening on the browser
|
||||
(cond ((not (null (string-match "^.*\\(iceweasel\\|firefox\\).*$" browse-url-generic-program))) "--private-window")
|
||||
((not (null (string-match "^.*\\(chrome\\|chromium\\).*$" browse-url-generic-program))) "--incognito" )
|
||||
(t "")
|
||||
))
|
||||
(old-b (list browse-url-generic-args " " ))
|
||||
(browse-url-generic-args (add-to-ordered-list 'old-b new-arg 0)))
|
||||
(progn
|
||||
(org-open-at-point)))
|
||||
(let ((browse-url-generic-args '("")))
|
||||
(org-open-at-point)))
|
||||
)))))
|
||||
|
||||
|
||||
;;; open links in visual selection
|
||||
(evil-define-operator evil-org-open-links (beg end type register yank-handler)
|
||||
:keep-visual t
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(evil-org-generic-open-links beg end type register yank-handler nil)
|
||||
)
|
||||
|
||||
;;; open links in visual selection in incognito mode
|
||||
(evil-define-operator evil-org-open-links-incognito (beg end type register yank-handler)
|
||||
:keep-visual t
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(evil-org-generic-open-links beg end type register yank-handler t)
|
||||
)
|
||||
|
||||
;; normal state shortcuts
|
||||
(evil-define-key 'normal evil-org-mode-map
|
||||
"gh" 'outline-up-heading
|
||||
"gp" 'outline-previous-heading
|
||||
"gj" (if (fboundp 'org-forward-same-level) ;to be backward compatible with older org version
|
||||
'org-forward-same-level
|
||||
'org-forward-heading-same-level)
|
||||
"gk" (if (fboundp 'org-backward-same-level)
|
||||
'org-backward-same-level
|
||||
'org-backward-heading-same-level)
|
||||
"gl" 'outline-next-visible-heading
|
||||
"t" 'org-todo
|
||||
"T" '(lambda () (interactive) (evil-org-eol-call (lambda() (org-insert-todo-heading nil))))
|
||||
"o" '(lambda () (interactive) (evil-org-eol-call 'clever-insert-item))
|
||||
"O" '(lambda () (interactive) (evil-org-eol-call 'org-insert-heading))
|
||||
"$" 'org-end-of-line
|
||||
"^" 'org-beginning-of-line
|
||||
"<" 'org-metaleft
|
||||
">" 'org-metaright
|
||||
"-" 'org-cycle-list-bullet
|
||||
(kbd "TAB") 'org-cycle)
|
||||
|
||||
;; normal & insert state shortcuts.
|
||||
(mapc (lambda (state)
|
||||
(evil-define-key state evil-org-mode-map
|
||||
(kbd "M-l") 'org-metaright
|
||||
(kbd "M-h") 'org-metaleft
|
||||
(kbd "M-k") 'org-metaup
|
||||
(kbd "M-j") 'org-metadown
|
||||
(kbd "M-L") 'org-shiftmetaright
|
||||
(kbd "M-H") 'org-shiftmetaleft
|
||||
(kbd "M-K") 'org-shiftmetaup
|
||||
(kbd "M-J") 'org-shiftmetadown
|
||||
(kbd "M-o") '(lambda () (interactive)
|
||||
(evil-org-eol-call
|
||||
'(lambda()
|
||||
(org-insert-heading)
|
||||
(org-metaright))))
|
||||
(kbd "M-t") '(lambda () (interactive)
|
||||
(evil-org-eol-call
|
||||
'(lambda()
|
||||
(org-insert-todo-heading nil)
|
||||
(org-metaright))))
|
||||
))
|
||||
'(normal insert))
|
||||
|
||||
;; vim-like confirm/abort for capture and src
|
||||
(with-eval-after-load 'org-capture
|
||||
(define-key org-capture-mode-map [remap evil-save-and-close] 'org-capture-finalize)
|
||||
(define-key org-capture-mode-map [remap evil-save-modified-and-close] 'org-capture-finalize)
|
||||
(define-key org-capture-mode-map [remap evil-quit] 'org-capture-kill))
|
||||
|
||||
(with-eval-after-load 'org-src
|
||||
(define-key org-src-mode-map [remap evil-save-and-close] 'org-edit-src-exit)
|
||||
(define-key org-src-mode-map [remap evil-save-modified-and-close] 'org-edit-src-exit)
|
||||
(define-key org-src-mode-map [remap evil-quit] 'org-edit-src-abort))
|
||||
|
||||
|
||||
(provide 'evil-org)
|
||||
;;; evil-org.el ends here
|
|
@ -10,33 +10,33 @@
|
|||
;;; License: GPLv3
|
||||
|
||||
(setq org-packages
|
||||
'(
|
||||
company
|
||||
company-emoji
|
||||
emoji-cheat-sheet-plus
|
||||
(evil-org :location local)
|
||||
evil-surround
|
||||
gnuplot
|
||||
htmlize
|
||||
;; ob, org and org-agenda are installed by `org-plus-contrib'
|
||||
(ob :location built-in)
|
||||
(org :location built-in)
|
||||
(org-agenda :location built-in)
|
||||
(org-expiry :location built-in)
|
||||
(org-journal :toggle org-enable-org-journal-support)
|
||||
org-download
|
||||
;; org-mime is installed by `org-plus-contrib'
|
||||
(org-mime :location built-in)
|
||||
org-pomodoro
|
||||
org-present
|
||||
(org-projectile :toggle (configuration-layer/package-usedp 'projectile))
|
||||
(ox-twbs :toggle org-enable-bootstrap-support)
|
||||
;; use a for of ox-gfm to fix index generation
|
||||
(ox-gfm :location (recipe :fetcher github :repo "syl20bnr/ox-gfm")
|
||||
:toggle org-enable-github-support)
|
||||
(ox-reveal :toggle org-enable-reveal-js-support)
|
||||
persp-mode
|
||||
))
|
||||
'(
|
||||
company
|
||||
company-emoji
|
||||
emoji-cheat-sheet-plus
|
||||
evil-org
|
||||
evil-surround
|
||||
gnuplot
|
||||
htmlize
|
||||
;; ob, org and org-agenda are installed by `org-plus-contrib'
|
||||
(ob :location built-in)
|
||||
(org :location built-in)
|
||||
(org-agenda :location built-in)
|
||||
(org-expiry :location built-in)
|
||||
(org-journal :toggle org-enable-org-journal-support)
|
||||
org-download
|
||||
;; org-mime is installed by `org-plus-contrib'
|
||||
(org-mime :location built-in)
|
||||
org-pomodoro
|
||||
org-present
|
||||
(org-projectile :toggle (configuration-layer/package-usedp 'projectile))
|
||||
(ox-twbs :toggle org-enable-bootstrap-support)
|
||||
;; use a for of ox-gfm to fix index generation
|
||||
(ox-gfm :location (recipe :fetcher github :repo "syl20bnr/ox-gfm")
|
||||
:toggle org-enable-github-support)
|
||||
(ox-reveal :toggle org-enable-reveal-js-support)
|
||||
persp-mode
|
||||
))
|
||||
|
||||
(defun org/post-init-company ()
|
||||
(spacemacs|add-company-backends :backends company-capf :modes org-mode))
|
||||
|
@ -49,15 +49,13 @@
|
|||
|
||||
(defun org/init-evil-org ()
|
||||
(use-package evil-org
|
||||
:commands (evil-org-mode evil-org-recompute-clocks)
|
||||
:init (add-hook 'org-mode-hook 'evil-org-mode)
|
||||
:config
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(evil-define-key 'normal evil-org-mode-map
|
||||
"O" 'evil-open-above)
|
||||
(spacemacs/set-leader-keys-for-major-mode 'org-mode
|
||||
"Cg" 'evil-org-recompute-clocks)
|
||||
(spacemacs|diminish evil-org-mode " ⓔ" " e"))))
|
||||
(add-hook 'org-mode-hook 'spacemacs//evil-org-mode)
|
||||
(setq evil-org-key-theme '(textobjects navigation additional)))
|
||||
:config
|
||||
(spacemacs|diminish evil-org-mode " ⓔ" " e")))
|
||||
|
||||
(defun org/post-init-evil-surround ()
|
||||
(defun spacemacs/add-org-surrounds ()
|
||||
|
@ -185,6 +183,7 @@ Will work on both org-mode and any mode that accepts plain html."
|
|||
|
||||
"Tt" 'org-show-todo-tree
|
||||
"Ti" 'org-toggle-inline-images
|
||||
"TT" 'org-todo
|
||||
"TV" 'space-doc-mode
|
||||
"Tx" 'org-toggle-latex-fragment
|
||||
|
||||
|
|
Loading…
Reference in New Issue