summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Tjörnhammar <e@cube2.se>2012-06-18 14:13:28 +0200
committerEdward Tjörnhammar <e@cube2.se>2012-06-18 14:13:28 +0200
commitda4ffb02616bc4ff489883402a9087aa26f71787 (patch)
tree9bdf65e08a0a42b3ee9be54791caf2c2ed43cb12
parent6caf43205613bcc49405c1eb635abad155bc421c (diff)
cleanup and fixes, now works ok
-rw-r--r--README.md3
-rw-r--r--evil-org-mode.el67
-rw-r--r--evil-org.el77
3 files changed, 79 insertions, 68 deletions
diff --git a/README.md b/README.md
index a7c3da5..9be3d15 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,8 @@ Installation
emacs.el
--------
- (require 'evil-org-mode)
+ (add-to-list 'load-path "~/.emacs.d/plugins/evil-org-mode")
+ (require 'evil-org)
License
=======
diff --git a/evil-org-mode.el b/evil-org-mode.el
deleted file mode 100644
index bf9a7c0..0000000
--- a/evil-org-mode.el
+++ /dev/null
@@ -1,67 +0,0 @@
-;;; evil-org-mode.el --- evil keybindings for org-mode
-
-;; Copyright: See respective authors
-;; Author: See respective commits
-;; URL: https://github.com/edwtjo/evil-org-mode.git
-;; Git-Repository; git://github.com/edwtjo/evil-org-mode.git
-;; Created: 2012-06-14
-;; Version: 9999
-;; 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/>.
-
-;; Known Bugs:
-;; See, https://github.com/edwtjo/evil-org-mode/issues
-
-(defun evil-org-mode/keybinds ()
- "Defines evil key bindings for org-mode"
- (require 'evil-mode)
- (require 'evil-leader)
- (require 'org-mode)
- (evil-declare-key 'normal org-mode-map
- "gh" 'outline-up-heading
- "gj" 'org-forward-same-level
- "gk" 'org-backward-same-level
- "gl" 'outline-next-visible-heading
- "H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
- "L" 'org-end-of-line ; smarter behaviour on headlines etc.
- "t" 'org-todo ; mark a TODO item as DONE
- "$" 'org-end-of-line ; smarter behaviour on headlines etc.
- "^" 'org-beginning-of-line ; ditto
- "-" 'org-ctrl-c-minus ; change bullet style
- "<" 'org-metaleft ; out-dent
- ">" 'org-metaright ; indent
- )
- (mapcar (lambda (state)
- (evil-declare-key state 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)
- (evil-leader/set-key state org-mode-map
- "c" 'org-cycle
- "e" 'org-export-dispatch
- "n" 'outline-next-visible-heading
- "p" 'outline-previous-visible-heading
- "t" 'org-set-tags-command
- "u" 'outline-up-heading)
- )
- '(normal insert)))
-(provide 'evil-org-mode)
diff --git a/evil-org.el b/evil-org.el
new file mode 100644
index 0000000..5057646
--- /dev/null
+++ b/evil-org.el
@@ -0,0 +1,77 @@
+;;; evil-org-mode.el --- evil keybindings for org-mode
+
+;; Copyright: See respective authors
+;; Author: See respective commits
+;; URL: https://github.com/edwtjo/evil-org-mode.git
+;; Git-Repository; git://github.com/edwtjo/evil-org-mode.git
+;; Created: 2012-06-14
+;; Version: 9999
+;; 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/>.
+
+;; Known Bugs:
+;; See, https://github.com/edwtjo/evil-org-mode/issues
+
+(require 'evil)
+(require 'evil-leader)
+(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
+
+;; regular normal state shortcuts.
+(evil-define-key 'normal evil-org-mode-map
+ "gh" 'outline-up-heading
+ "gj" 'org-forward-same-level
+ "gk" 'org-backward-same-level
+ "gl" 'outline-next-visible-heading
+ "H" 'org-beginning-of-line
+ "L" 'org-end-of-line
+ "t" 'org-todo
+ "$" 'org-end-of-line
+ "^" 'org-beginning-of-line
+ "-" 'org-ctrl-c-minus
+ "<" 'org-metaleft
+ ">" 'org-metaright)
+
+;; leader shortcuts in normal state. (disabled for now)
+;; (evil-leader/set-key 'normal evil-org-mode-map
+;; "c" 'org-cycle
+;; "e" 'org-export-dispatch
+;; "n" 'outline-next-visible-heading
+;; "p" 'outline-previous-visible-heading
+;; "t" 'org-set-tags-command
+;; "u" 'outline-up-heading)
+
+;; normal & insert state shortcuts.
+(mapcar (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)) '(normal insert))
+(provide 'evil-org)