 
 ;; -- counsel projectile
 (prelude-require-package 'counsel-projectile)
-(require 'counsel-projectile)
-(counsel-projectile-mode +1)
+(use-package counsel-projectile
+  :config
+  (counsel-projectile-mode +1))
 
 
 ;; -- calfw
 (prelude-require-packages '(calfw calfw-org))
-(require 'calfw)
-(require 'calfw-org)
 
 
 (provide 'general)



;; -- custom ace-window shortcut (<s-w>, i.e., Command-w doesn't work in terminal)
(global-set-key (kbd "M-p") 'ace-window)


;; -- disable system bip
(setq visible-bell t)


;; -- standard keys for cut/copy/paste
(cua-mode 1)


;; -- line numbers in left margin (+ auto off)
(require 'linum-off)
(require 'linum)

(global-linum-mode 0)
(global-set-key (kbd "C-x n") 'linum-mode)

;; separate line numbers from text
;; fancy but very slow (that's why limum mode is disabled by default)
(defvar-local linum-format-fmt nil)

(unless window-system
  (add-hook 'linum-before-numbering-hook
            (lambda ()
              (setq-local linum-format-fmt
                          (let ((w (length (number-to-string
                                            (count-lines (point-min) (point-max))))))
                            (concat "%" (number-to-string w) "d"))))))

(defun linum-format-func(line)
  (concat
   (propertize (format linum-format-fmt line) 'face 'linum)
   (propertize " " 'face 'mode-line)))

(unless window-system
  (setq linum-format 'linum-format-func))


;; -- disable guru mode
(require 'prelude-custom)
(setq prelude-guru nil)


;; -- disable flyspell
;; (setq prelude-flyspell nil)


;; -- set en_US as default dictionary
(require 'ispell)
(setq ispell-dictionary "en_US")


;;  -- flycheck settings
(require 'flycheck)

(add-hook 'after-init-hook #'global-flycheck-mode)
(setq flycheck-check-syntax-automatically '(mode-enabled save))
(setq flycheck-indication-mode 'left-fringe)
(setq-default flycheck-emacs-lisp-load-path 'inherit)

(defun flycheck-buffer-and-list-errors()
  "execute command flycheck-buffer and flycheck-list-errors"
  (interactive)
  (flycheck-buffer)
  (flycheck-list-errors)
  (other-window 1)
  )

(defun flycheck-mode-keys()
  "key map for flycheck-mode"
  (local-set-key (kbd "<f7>") 'flycheck-buffer-and-list-errors)
  )

(add-hook 'flycheck-mode-hook 'flycheck-mode-keys)

;; -- web-mode settings
(use-package web-mode
  :init
  (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))

  )


;; -- multi-term
(prelude-require-package 'multi-term)
(use-package multi-term
  :config
  (setq multi-term-program "/usr/local/bin/bash"))


;; -- git / diff
(prelude-require-package 'git-gutter)

(use-package diff-hl
  :config
  (global-diff-hl-mode -1))

(use-package git-gutter
  :after (diff-hl)
  :requires (linum)
  :config
  (global-git-gutter-mode +1)
  (git-gutter:linum-setup))

(custom-set-variables
 '(git-gutter:modified-sign "!")
 '(git-gutter:added-sign "+")
 '(git-gutter:deleted-sign "-"))

(require 'zenburn-theme)

(zenburn-with-color-variables
  (custom-theme-set-faces
   'zenburn
   ;; copied from zenburn-theme colors set for diff-hl
   `(git-gutter:modified ((t (:foreground ,zenburn-blue
                              :background ,zenburn-blue-2))))
   `(git-gutter:added ((t (:foreground ,zenburn-green+1
