dotfiles/files/init.el

91 lines
3.0 KiB
EmacsLisp
Raw Normal View History

2015-03-23 02:57:57 +00:00
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;;; from purcell/emacs.d
(defun require-package (package &optional min-version no-refresh)
"Install given PACKAGE, optionally requiring MIN-VERSION.
If NO-REFRESH is non-nil, the available package lists will not be
re-downloaded in order to locate PACKAGE."
(if (package-installed-p package min-version)
t
(if (or (assoc package package-archive-contents) no-refresh)
(package-install package)
(progn
(package-refresh-contents)
(require-package package min-version t)))))
(package-initialize)
(require-package 'evil)
(setq evil-search-module 'evil-search
evil-want-C-u-scroll t
evil-want-C-w-in-emacs-state t)
(require 'evil)
(evil-mode t)
;; Remap org-mode meta keys for convenience
(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))
'(normal insert))
(defun my-20-lines-down ()
(interactive)
(evil-next-line 20))
(defun my-20-lines-up ()
(interactive)
(evil-previous-line 20))
(define-key evil-normal-state-map "H" 'my-20-lines-down)
(define-key evil-normal-state-map "T" 'my-20-lines-up)
(define-key evil-visual-state-map "d" 'evil-backward-char)
(define-key evil-visual-state-map "h" 'evil-next-line)
(define-key evil-visual-state-map "t" 'evil-previous-line)
(define-key evil-visual-state-map "n" 'evil-forward-char)
(define-key evil-normal-state-map "j" 'kill-line)
(define-key evil-normal-state-map "H" 'my-20-lines-down)
(define-key evil-normal-state-map "T" 'my-20-lines-up)
(define-key evil-normal-state-map "d" 'evil-backward-char)
(define-key evil-normal-state-map "h" 'evil-next-line)
(define-key evil-normal-state-map "t" 'evil-previous-line)
(define-key evil-normal-state-map "n" 'evil-forward-char)
(define-key evil-normal-state-map "j" 'kill-line)
(define-key evil-normal-state-map "l" 'evil-next-match)
(define-key evil-normal-state-map "L" 'evil-previous-match)
(define-key evil-normal-state-map "-" 'evil-end-of-line)
(define-key evil-normal-state-map "_" 'evil-first-non-blank)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(display-battery-mode t)
'(scroll-bar-mode nil)
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)