Automatic package installation :)

This commit is contained in:
madmaurice 2017-05-15 14:25:35 +02:00
parent 1b6ed7988b
commit 388643d07f

View file

@ -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 <up>") 'windmove-up)
(global-set-key (kbd "C-x <down>") 'windmove-down)
(global-set-key (kbd "C-x <left>") 'windmove-left)
(global-set-key (kbd "C-x <right>") 'windmove-right)
;; Window cycling
(defun cycle-window ()
"cycles windows"
(interactive)
(select-window (next-window)))
(global-set-key (kbd "<C-tab>") '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))