3 changed files with 129 additions and 0 deletions
@ -0,0 +1,123 @@ |
|||
;;; prelude-evil.el --- Emacs Prelude: evil-mode configuration. |
|||
;; |
|||
;; Copyright © 2011-2013 Bozhidar Batsov |
|||
;; |
|||
;; Author: Bozhidar Batsov <bozhidar@batsov.com> |
|||
;; URL: http://batsov.com/prelude |
|||
;; Version: 1.0.0 |
|||
;; Keywords: convenience |
|||
|
|||
;; This file is not part of GNU Emacs. |
|||
|
|||
;;; Commentary: |
|||
|
|||
;; Some basic configuration for evil-mode. |
|||
|
|||
;;; License: |
|||
|
|||
;; 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 GNU Emacs; see the file COPYING. If not, write to the |
|||
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|||
;; Boston, MA 02110-1301, USA. |
|||
|
|||
;;; Code: |
|||
|
|||
;;; goto-chg lets you use the g-; and g-, to go to recent changes |
|||
;;; evil-visualstar enables searching visual selection with * |
|||
;;; evil-numbers enables vim style numeric incrementing and decrementing |
|||
|
|||
(prelude-require-packages '(evil goto-chg surround evil-visualstar evil-numbers)) |
|||
|
|||
(setq evil-mode-line-format 'before) |
|||
|
|||
(setq evil-emacs-state-cursor '("red" box)) |
|||
(setq evil-normal-state-cursor '("gray" box)) |
|||
(setq evil-visual-state-cursor '("gray" box)) |
|||
(setq evil-insert-state-cursor '("gray" bar)) |
|||
(setq evil-motion-state-cursor '("gray" box)) |
|||
|
|||
(evil-mode 1) |
|||
(global-surround-mode 1) |
|||
|
|||
(define-key evil-normal-state-map (kbd "C-A") |
|||
'evil-numbers/inc-at-pt) |
|||
(define-key evil-normal-state-map (kbd "C-S-A") |
|||
'evil-numbers/dec-at-pt) |
|||
|
|||
;; |
|||
;; Other useful Commands |
|||
;; |
|||
(evil-ex-define-cmd "W" 'evil-write-all) |
|||
(evil-ex-define-cmd "Tree" 'speedbar-get-focus) |
|||
(evil-ex-define-cmd "linum" 'linum-mode) |
|||
(evil-ex-define-cmd "Align" 'align-regexp) |
|||
|
|||
|
|||
;; Scrolling |
|||
(defun prelude-evil-scroll-down-other-window () |
|||
(interactive) |
|||
(scroll-other-window)) |
|||
|
|||
(defun prelude-evil-scroll-up-other-window () |
|||
(interactive) |
|||
(scroll-other-window '-)) |
|||
|
|||
(define-key evil-normal-state-map |
|||
(kbd "C-S-d") 'prelude-evil-scroll-down-other-window) |
|||
|
|||
(define-key evil-normal-state-map |
|||
(kbd "C-S-u") 'prelude-evil-scroll-up-other-window) |
|||
|
|||
;; |
|||
;; Magit from avsej |
|||
;; |
|||
(evil-add-hjkl-bindings magit-log-mode-map 'emacs) |
|||
(evil-add-hjkl-bindings magit-commit-mode-map 'emacs) |
|||
(evil-add-hjkl-bindings magit-branch-manager-mode-map 'emacs |
|||
"K" 'magit-discard-item |
|||
"L" 'magit-key-mode-popup-logging) |
|||
(evil-add-hjkl-bindings magit-status-mode-map 'emacs |
|||
"K" 'magit-discard-item |
|||
"l" 'magit-key-mode-popup-logging |
|||
"h" 'magit-toggle-diff-refine-hunk) |
|||
|
|||
(setq evil-shift-width 2) |
|||
|
|||
;;; enable ace-jump mode with evil-mode |
|||
(define-key evil-normal-state-map (kbd "SPC") 'ace-jump-mode) |
|||
|
|||
;;; snagged from Eric S. Fraga |
|||
;;; http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00153.html |
|||
(defun prelude-evil-key-bindings-for-org () |
|||
;;(message "Defining evil key bindings for org") |
|||
(evil-declare-key 'normal org-mode-map |
|||
"gk" 'outline-up-heading |
|||
"gj" '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 |
|||
",c" 'org-cycle |
|||
(kbd "TAB") '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 |
|||
"$" '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 |
|||
)) |
|||
(prelude-evil-key-bindings-for-org) |
|||
(provide 'prelude-evil) |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue