diff options
| author | Somelauw <Somelauw> | 2017-07-20 22:58:11 +0200 |
|---|---|---|
| committer | Somelauw <Somelauw> | 2017-07-20 22:58:11 +0200 |
| commit | bc1c0446b49fb53b281ec66e75506e08a5c6d3a8 (patch) | |
| tree | f6f71be920b374c8ce9ae534ac1198bab2c786f3 | |
| parent | 5f496f13355e7098b34a047794581687cc6499a9 (diff) | |
Allow $ to jump back-and-forth in evil when org-special-ctrl-a/e is t.
Regardless of what evil-move-beyond-eol and evil-move-cursor-back are set to.
| -rw-r--r-- | doc/changelog.org | 1 | ||||
| -rw-r--r-- | doc/keythemes.org | 4 | ||||
| -rw-r--r-- | evil-org.el | 17 |
3 files changed, 18 insertions, 4 deletions
diff --git a/doc/changelog.org b/doc/changelog.org index 6ad4c75..a0a4ce6 100644 --- a/doc/changelog.org +++ b/doc/changelog.org @@ -2,6 +2,7 @@ - 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= - Bind =org-beginning-to-line= to =0=. Leave =^= mapped to =evil-first-non-blank=. + - Improve interaction between evil and =org-special-ctrl-a/e=. * Version 0.7 - A hook is no longer created automatically. The following line of code is from now on required in a user config: #+BEGIN_SRC emacs-lisp diff --git a/doc/keythemes.org b/doc/keythemes.org index 3b0b727..265b6c0 100644 --- a/doc/keythemes.org +++ b/doc/keythemes.org @@ -16,8 +16,8 @@ |-------+-------------------------------+-----------------------------------------| | =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 | - | =0= | org-beginning-of-line | like 0 but can be special* | - | =$= | org-end-of-line | like $ but can be special* | + | =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 | | =o= | evil-org-open-below | like o but continue tables and items* | | =O= | evil-org-open-above | like O but continue tables and items* | diff --git a/evil-org.el b/evil-org.el index 6245352..d2de504 100644 --- a/evil-org.el +++ b/evil-org.el @@ -250,6 +250,19 @@ Optional argument ARG If one prefix argument is given, insert at the end of curr :jump t (while (org-up-heading-safe))) +(evil-define-motion evil-org-end-of-line (&optional n) + "Like evil-org-end-of-line but makes org-special-ctrl-a work in evil." + (when (and org-special-ctrl-a/e + evil-move-cursor-back + (not evil-move-beyond-eol) + (memq evil-state '(normal visual operator)) + (not (invisible-p (line-end-position))) + (= (point) (1- (line-end-position)))) + (forward-char)) + (org-end-of-line n)) + +(defalias 'evil-org-beginning-of-line 'org-beginning-of-line) + ;;; operators (evil-define-operator evil-org-demote-or-indent (beg end count) "Demote or indent selection (dwim)." @@ -505,9 +518,9 @@ Includes tables, list items and subtrees." "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" 'org-beginning-of-line)) + (evil-redirect-digit-argument motion-map "0" 'evil-org-beginning-of-line)) (evil-define-key 'motion evil-org-mode-map - (kbd "$") 'org-end-of-line + (kbd "$") 'evil-org-end-of-line (kbd "x") 'evil-org-delete-char (kbd "X") 'evil-org-delete-backward-char (kbd ")") 'evil-org-forward-sentence |
