summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSomelauw <Somelauw>2017-08-25 14:52:14 +0200
committerSomelauw <Somelauw>2017-08-25 14:52:14 +0200
commit3c49d00dd7c9e058f40d9af12a11f49e3c9eb115 (patch)
treea74512d4a4617066dcb28a212fb9b1b40507f074
parent85e31c8452c9c8adb2c01249dfe3e1808476babe (diff)
Make A and I ignore leading stars, tags and ellipses
-rw-r--r--doc/changelog.org2
-rw-r--r--doc/keythemes.org8
-rw-r--r--evil-org.el30
3 files changed, 35 insertions, 5 deletions
diff --git a/doc/changelog.org b/doc/changelog.org
index 734ce19..c3bcd71 100644
--- a/doc/changelog.org
+++ b/doc/changelog.org
@@ -1,3 +1,5 @@
+* Version 0.9
+ - Make I / A ignore leading stars, tags and ellipses on headings
* Version 0.8
- Make evil-org-a-greater-org-object (=ar=), evil-org-inner/a-subtree (=iR=, =aR=) text objects linewise. The other text objects remain characterwise.
- Improvements to =o/O=
diff --git a/doc/keythemes.org b/doc/keythemes.org
index 231968b..80cc8a9 100644
--- a/doc/keythemes.org
+++ b/doc/keythemes.org
@@ -14,13 +14,15 @@
|-------+-------------------------------+-----------------------------------------|
| key | function | explanation |
|-------+-------------------------------+-----------------------------------------|
- | =x= | evil-org-delete-char | like x but keep tables and tags aligned |
- | =X= | evil-org-delete-previous-char | like X but keep tables and tags aligned |
+ | =TAB= | org-cycle | change folding level of current heading |
| =0= | evil-org-beginning-of-line | like 0 but can be special* |
| =$= | evil-org-end-of-line | like $ but can be special* |
- | =TAB= | org-cycle | change folding level of current heading |
+ | =I= | evil-org-insert-line | like I but ignore leading stars |
+ | =A= | evil-org-append-line | like A but ignore tags and ellipses |
| =o= | evil-org-open-below | like o but continue tables and items* |
| =O= | evil-org-open-above | like O but continue tables and items* |
+ | =x= | evil-org-delete-char | like x but keep tables and tags aligned |
+ | =X= | evil-org-delete-previous-char | like X but keep tables and tags aligned |
| =(= | org-forward-sentence | next cell in table |
| =)= | org-backward-sentence | previous cell in table |
| ={= | org-backward-paragraph | beginning of table |
diff --git a/evil-org.el b/evil-org.el
index 5cf06ea..fa2822c 100644
--- a/evil-org.el
+++ b/evil-org.el
@@ -7,7 +7,7 @@
;; Git-Repository: git://github.com/Somelauw/evil-org-mode.git
;; Created: 2012-06-14
;; Forked-since: 2017-02-12
-;; Version: 0.8.6
+;; Version: 0.9.0
;; Package-Requires: ((emacs "24.4") (evil "1.0") (org "8.0.0"))
;; Keywords: evil vim-emulation org-mode key-bindings presets
@@ -130,6 +130,31 @@ Optional argument ARGUMENTS arguments to pass to FUN."
(apply fun arguments)
(evil-insert nil))
+;;; insertion commands
+(defun evil-org-insert-line (count)
+ "Insert at beginning of line, but ignore heading and item markers.
+The insertion will be repeated COUNT times."
+ (interactive "p")
+ (if (org-at-heading-or-item-p)
+ ;; Manipulate org-beginning-of-line to become special
+ (let ((org-special-ctrl-a/e t))
+ (beginning-of-line)
+ (org-beginning-of-line nil)
+ (evil-insert count))
+ (evil-insert-line count)))
+
+(defun evil-org-append-line (count)
+ "Insert at beginning of line but ignore tags and ellipses at end of the line.
+The insertion will be repeated COUNT times."
+ (interactive "p")
+ (if (org-at-heading-p)
+ ;; Manipulate org-end-of-line to become special
+ (let ((org-special-ctrl-a/e t))
+ (end-of-line)
+ (org-end-of-line nil)
+ (evil-insert count))
+ (evil-append-line count)))
+
(defun evil-org-open-below (count)
"Clever insertion of org item.
Argument COUNT number of lines to insert.
@@ -518,7 +543,6 @@ Includes tables, list items and subtrees."
;;; Keythemes
(defun evil-org--populate-base-bindings ()
"Bindings that are always available."
- ;; (let-alist evil-org-movement-bindings)
(let ((motion-map (evil-get-auxiliary-keymap evil-org-mode-map 'motion t)))
(evil-redirect-digit-argument motion-map "0" 'evil-org-beginning-of-line))
(evil-define-key 'motion evil-org-mode-map
@@ -544,6 +568,8 @@ Includes tables, list items and subtrees."
(kbd "<tab>") 'org-cycle
(kbd "<S-tab>") 'org-shifttab))
(evil-define-key 'normal evil-org-mode-map
+ (kbd "I") 'evil-org-insert-line
+ (kbd "A") 'evil-org-append-line
(kbd "o") 'evil-org-open-below
(kbd "O") 'evil-org-open-above))