summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <meyerkya@gmail.com>2013-01-08 23:42:27 -0500
committerKyle Meyer <meyerkya@gmail.com>2013-01-09 12:05:56 -0500
commit74be503228a6c4a066b3ac9cc8b508f299cc27b4 (patch)
treec5787b41103195bb918ef1b82b6950d2dbb80783
parent9bab9933e03eb01c3987471cc4587c7244f1d794 (diff)
downloademacs.d-74be503228a6c4a066b3ac9cc8b508f299cc27b4.tar.gz
evil: cleanup binding
- add eval-region under hook restructure org evil bindings - model after cofi's config - github.com/cofi/dotfiles/blob/master/emacs.d/config/cofi-evil.el - move org-export under here don't bind jf with keychord don't use ,j ,k (use builtin evil mappings)
-rw-r--r--conf/ev.el93
-rw-r--r--conf/om.el47
2 files changed, 80 insertions, 60 deletions
diff --git a/conf/ev.el b/conf/ev.el
index 406ecc5..87d5375 100644
--- a/conf/ev.el
+++ b/conf/ev.el
@@ -20,22 +20,19 @@
(kill-this-buffer)
)
-(defun my-back-one-window ()
- "Go back one windo"
- (interactive)
- (other-window -1))
+(define-key evil-insert-state-map "jf" 'evil-normal-state)
(define-key evil-normal-state-map ",w" 'save-buffer)
-(define-key evil-normal-state-map "Q" 'fill-paragraph)
-(define-key evil-normal-state-map ",b" 'ido-switch-buffer)
+(define-key evil-normal-state-map ",q" 'kill-buffer)
(define-key evil-normal-state-map ",d" 'save-and-kill-buffer)
-(define-key evil-visual-state-map ",c" 'comment-or-uncomment-region)
+(define-key evil-normal-state-map "Q" 'fill-paragraph)
-(define-key evil-normal-state-map ",j" 'other-window)
-(define-key evil-normal-state-map ",k" 'my-back-one-window)
-(define-key evil-normal-state-map ",q" 'kill-buffer)
-(define-key evil-normal-state-map ",a" 'org-archive-subtree)
+(evil-define-key 'visual emacs-lisp-mode-map
+ ",e" 'eval-region)
+(evil-define-key 'visual lisp-interaction-mode-map
+ ",e" 'eval-region)
+(define-key evil-visual-state-map ",c" 'comment-or-uncomment-region)
(fset 'comment-this-line ;; this depends on evil bindings
"0v$,c")
(define-key evil-normal-state-map ",c" 'comment-this-line)
@@ -43,11 +40,81 @@
(require 'key-chord)
(key-chord-mode 1)
-(key-chord-define-global "jf" 'evil-normal-state)
(key-chord-define-global ",r" 'recentf-ido-find-file)
(key-chord-define-global ",t" 'org-capture)
-(key-chord-define-global ",e" 'org-export-as-pdf)
;; instead of alt-x
(key-chord-define-global ",x" 'execute-extended-command)
(key-chord-define-global ",f" 'find-file)
(key-chord-define-global ",g" 'indent-relative)
+(key-chord-define-global ",b" 'ido-switch-buffer)
+
+;; org bindings
+(defun always-insert-item ()
+ (interactive)
+ (if (not (org-in-item-p))
+ (insert "\n- ")
+ (org-insert-item)))
+
+;; most from cofi config
+(evil-define-key 'normal org-mode-map
+ (kbd "RET") 'org-open-at-point
+ "za" 'org-cycle
+ "zA" 'org-shifttab
+ "zm" 'hide-body
+ "zr" 'show-all
+ "zo" 'show-subtree
+ "zO" 'show-all
+ "zc" 'hide-subtree
+ "zC" 'hide-all
+ ",e" 'org-export-as-pdf
+ ",a" 'org-archive-subtree
+ ",s" 'org-todo
+ "O" (lambda ()
+ (interactive)
+ (end-of-line)
+ (org-insert-heading t)
+ (evil-append nil))
+ "o" (lambda ()
+ (interactive)
+ (end-of-line)
+ (always-insert-item)
+ (evil-append nil))
+(kbd "M-j") 'org-shiftleft
+ (kbd "M-k") 'org-shiftright
+ (kbd "M-H") 'org-metaleft
+ (kbd "M-J") 'org-metadown
+ (kbd "M-K") 'org-metaup
+ (kbd "M-L") 'org-metaright)
+
+(evil-define-key 'normal orgstruct-mode-map
+ (kbd "RET") 'org-open-at-point
+ "za" 'org-cycle
+ "zA" 'org-shifttab
+ "zm" 'hide-body
+ "zr" 'show-all
+ "zo" 'show-subtree
+ "zO" 'show-all
+ "zc" 'hide-subtree
+ "zC" 'hide-all
+ (kbd "M-j") 'org-shiftleft
+ (kbd "M-k") 'org-shiftright
+ (kbd "M-H") 'org-metaleft
+ (kbd "M-J") 'org-metadown
+ (kbd "M-K") 'org-metaup
+ (kbd "M-L") 'org-metaright)
+
+(evil-define-key 'insert org-mode-map
+ (kbd "M-j") 'org-shiftleft
+ (kbd "M-k") 'org-shiftright
+ (kbd "M-H") 'org-metaleft
+ (kbd "M-J") 'org-metadown
+ (kbd "M-K") 'org-metaup
+ (kbd "M-L") 'org-metaright)
+
+(evil-define-key 'insert orgstruct-mode-map
+ (kbd "M-j") 'org-shiftleft
+ (kbd "M-k") 'org-shiftright
+ (kbd "M-H") 'org-metaleft
+ (kbd "M-J") 'org-metadown
+ (kbd "M-K") 'org-metaup
+ (kbd "M-L") 'org-metaright)
diff --git a/conf/om.el b/conf/om.el
index 333d553..3742109 100644
--- a/conf/om.el
+++ b/conf/om.el
@@ -13,8 +13,6 @@
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-log-done t)
-(defun prelude-org-mode-defaults ()
- (electric-indent-mode -1))
;; allow for file to end in txt
(add-to-list 'auto-mode-alist '("\\.org.txt$" . org-mode))
@@ -88,51 +86,6 @@
(plain-list-item . auto))))
(setq org-cycle-separator-lines 1)
-;; for evil setup
-;; put here because wasn't loading when in evil config file
-(eval-after-load "org"
- '(progn
- (defun always-insert-item ()
- (interactive)
- (if (not (org-in-item-p))
- (insert "\n- ")
- (org-insert-item)))
-
- (evil-define-key 'normal org-mode-map "O" (lambda ()
- (interactive)
- (end-of-line)
- (org-insert-heading t)
- (evil-append nil)
- ))
-
- (evil-define-key 'normal org-mode-map "o" (lambda ()
- (interactive)
- (end-of-line)
- (always-insert-item)
- (evil-append nil)
- ))
- ; mark a TODO item as DONE
- ; s - status
- (evil-define-key 'normal org-mode-map ",s" 'org-todo)
- ;change bullet style
- (evil-define-key 'normal org-mode-map "-" 'org-cycle-list-bullet)
- ;; (evil-define-key 'normal org-mode-map "L" 'org-shiftright)
- ;; (evil-define-key 'normal org-mode-map "H" 'org-shiftleft)
- ;; (evil-define-key 'normal org-mode-map "K" 'org-shiftup)
- ;; (evil-define-key 'normal org-mode-map "J" 'org-shiftdown)
- (evil-define-key 'normal org-mode-map (kbd "M-l") 'org-metaright)
- (evil-define-key 'normal org-mode-map (kbd "M-h") 'org-metaleft)
- (evil-define-key 'normal org-mode-map (kbd "M-k") 'org-metaup)
- (evil-define-key 'normal org-mode-map (kbd "M-j") 'org-metadown)
- (evil-define-key 'normal org-mode-map (kbd "M-L") 'org-shiftmetaright)
- (evil-define-key 'normal org-mode-map (kbd "M-H") 'org-shiftmetaleft)
- (evil-define-key 'normal org-mode-map (kbd "M-K") 'org-shiftmetaup)
- (evil-define-key 'normal org-mode-map (kbd "M-J") 'org-shiftmetadown)
-
- ;; ;;; org agenda -- leave in emacs mode but add j & k
- ;; (define-key org-agenda-mode-map "j" 'evil-next-line)
- ;; (define-key org-agenda-mode-map "k" 'evil-previous-line))
- ))
;; from http://doc.norang.ca/org-mode.html
(setq org-refile-targets (quote ((nil :maxlevel . 5)