                                         ; if we cannot require it, it does not exist, yet. So install it.
       (error (package-install package))))
 (package-initialize)
-(package-refresh-contents)
+(unless (file-exists-p "~/.emacs.d/elpa/archives/melpa")
+(package-refresh-contents))
 
 ;; define custom lisp directory and load all subdirectories too
 (let ((default-directory "~/.emacs.d/site-lisp/"))

;; (autoload 'python-mode "python-mode" "Python editing mode." t)
;; ;; jedi completion
;; (add-hook 'python-mode-hook 'jedi:setup)
(elpy-enable)
(elpy-use-ipython)

;; Sometimes you have to
(require 'php-mode)


(require 'rainbow-delimiters)
(add-hook 'ess-mode-hook 'rainbow-delimiters-mode)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) ; for programming related modes

;; Finally giving in to being evil
(require 'evil)
(evil-mode 1)
(setq evil-auto-indent t)
(setq evil-regexp-search t)
(setq evil-want-C-i-jump t)
(setq evil-normal-state-cursor '("white" box))
(setq evil-insert-state-cursor '("white" bar))
(add-hook 'text-mode-hook 'turn-on-evil-mode)
(add-hook 'prog-mode-hook 'turn-on-evil-mode)
(define-key evil-normal-state-map "\C-e" 'evil-end-of-line)
(define-key evil-insert-state-map "\C-e" 'end-of-line)
(define-key evil-visual-state-map "\C-e" 'evil-end-of-line)
(define-key evil-normal-state-map "\C-w" 'evil-delete)
(define-key evil-insert-state-map "\C-w" 'evil-delete)
(define-key evil-visual-state-map "\C-w" 'evil-delete)
(define-key evil-normal-state-map "\C-y" 'yank)
(define-key evil-insert-state-map "\C-y" 'yank)
(define-key evil-visual-state-map "\C-y" 'yank)
(define-key evil-normal-state-map "\C-k" 'kill-line)
(define-key evil-insert-state-map "\C-k" 'kill-line)
(define-key evil-visual-state-map "\C-k" 'kill-line)

;; yascroll
(global-yascroll-bar-mode 1)
