                     nil
                     :foreground "gray50")
 
-(set-face-attribute 'helm-ff-executable
-                    nil
-                    :foreground "#228b22")
-
-(set-face-attribute 'helm-selection
-                    nil
-                    :background "#a5e8be")
-
-(set-face-attribute 'helm-visible-mark
-                    nil
-                    :background "#f1c40f")
-
-(set-face-attribute 'helm-source-header
-                    nil
-                    :height 0.9)
-
 (set-face-attribute 'font-lock-comment-face
                     nil
                     ;; :height 0.9


(setq python-shell-completion-native-enable nil)

(require 'projectile)
(setq projectile-enable-caching t)
(projectile-global-mode)
(diminish 'projectile-mode)
(add-to-list 'projectile-globally-ignored-files ".DS_Store")
(add-to-list 'projectile-globally-ignored-directories ".build")
(add-to-list 'projectile-globally-ignored-directories "build")
(add-to-list 'projectile-globally-ignored-directories ".cquery_cached_index")

(require 'helm)
(require 'helm-config)
(require 'helm-grep)
(helm-mode 1)   ;; completion-read etc..
(diminish 'helm-mode)
(setq helm-candidate-number-limit 100
      helm-buffer-max-length 32
      helm-display-header-line nil
      helm-mode-fuzzy-match t
      helm-completion-in-region-fuzzy-match t
      helm-imenu-fuzzy-match t
      helm-find-files-ignore-thing-at-point t)

;; (helm-push-mark-mode 1)
(bind-keys :map helm-map
           ("<tab>" . helm-execute-persistent-action)
           ("C-i" . helm-execute-persistent-action)
           ("C-z" . helm-select-action))

(add-hook 'helm-grep-mode-hook 'grep-mode)
(setq helm-grep-save-buffer-name-no-confirm 1)
(setq helm-grep-file-path-style 'relative)

(setq projectile-completion-system 'helm)
(helm-projectile-on)

(bind-key "M-g" '(lambda ()
                   (interactive)
                   (if *windows* (helm-grep-do-git-grep "")
                     (helm-grep-ag (projectile-project-root) nil))))

;; ;; helm-ag
;; (setq helm-ag-insert-at-point t)
;; (setq helm-ag--action-save-buffer #'helm-grep-save-results
;; (bind-key "M-g" 'helm-projectile-ag)

;; TODO:
;; - thing-at-point
;; - spustit helm-grep z isearch
;; - helm-ag (volano z helm-projectile-ag) ma v gr pro "args flags 0" neprazdny vysledek, zatimco helm-grep-ag nic nenajde

(bind-key* "M-G"     ;; overrides any mode-specific bindings
           (if *windows* 'helm-grep-do-git-grep
             '(lambda ()
                (interactive)
                (helm-grep-ag (helm-current-directory) nil))))    ;; nebo expand-file-name default-directory ?

(bind-key "M-i" 'helm-occur-from-isearch isearch-mode-map)

;; (require 'helm-for-files)    ;; helm-source-recentf
;;(setq helm-M-x t)

(defun my-helm-projectile-buffers-list ()
  (interactive)
  (unless helm-source-buffers-list
    (setq helm-source-buffers-list
          (helm-make-source "Buffers" 'helm-source-buffers)))
  (helm :sources (if (projectile-project-p)
                     '(helm-source-buffers-list
                       helm-source-projectile-files-list
                       helm-source-buffer-not-found)
                   '(helm-source-buffers-list
                     helm-source-buffer-not-found))
        :buffer "*helm buffers*"
        :keymap helm-buffer-map
        :truncate-lines helm-buffers-truncate-lines))

(bind-keys ([remap list-buffers] . my-helm-projectile-buffers-list)
           ("M-x" . helm-M-x)
           ("C-x b" . my-helm-projectile-buffers-list)
           ("C-h a" . helm-apropos)
           ("C-x C-f" . helm-find-files)
           ("M-y" . helm-show-kill-ring)
           ("M-i" . helm-occur)
           ("C-c h" . helm-command-prefix)
           ("C-c <SPC>" . helm-all-mark-rings)
           ("C-c C-r" . helm-resume))

(require 'helm-ext)
(helm-ext-ff-enable-auto-path-expansion t)

(require 'helpful)
(bind-keys ("C-h f" . helpful-function)

                     flymake-lua
                     haskell-mode
                     restart-emacs
                     projectile
                     super-save
                     anzu
                     ivy
                     ivy-hydra
                     smex
                     counsel
                     counsel-projectile
                     avy
                     goto-chg
                     unfill
