diff --git a/emacs/.emacs b/emacs/.emacs index d606d1e..02a8ce6 100644 --- a/emacs/.emacs +++ b/emacs/.emacs @@ -1,11 +1,21 @@ (package-initialize) +(defun ensure-packages-installed (packages) + "Ensure packages are installed" + (mapcar + (lambda (package) + (if (package-installed-p package) + nil + (if (y-or-n-p (format "Package %s is missing. Install it? " package)) + (package-install package) + package))) + packages)) + (require 'package) (push '("marmalade" . "http://marmalade-repo.org/packages/") package-archives) (push '("melpa" . "http://melpa.milkbox.net/packages/") package-archives) -(package-initialize) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -30,5 +40,31 @@ ;; If there is more than one, they won't work right. '(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "PfEd" :family "Inconsolata"))))) +;; ensure repo cache is up1date +(or (file-exists-p package-user-dir) + (package-refresh-contents)) + +(ensure-packages-installed '(org evil evil-surround magit evil-magit)) + (require 'evil) (evil-mode t) + +;; Window movement +(global-set-key (kbd "C-x ") 'windmove-up) +(global-set-key (kbd "C-x ") 'windmove-down) +(global-set-key (kbd "C-x ") 'windmove-left) +(global-set-key (kbd "C-x ") 'windmove-right) + +;; Window cycling +(defun cycle-window () + "cycles windows" + (interactive) + (select-window (next-window))) + +(global-set-key (kbd "") 'cycle-window) + +;; Overlay windows +(add-to-list 'display-buffer-alist + '("*Apropos*" display-buffer-same-window)) +(add-to-list 'display-buffer-alist + '("*Help*" display-buffer-same-window))