 
 (bind-key "M-g" '(lambda ()
                    (interactive)
-                   (helm-grep-ag (projectile-project-root) current-prefix-arg)))
+                   (counsel-rg (thing-at-point 'symbol t)
+                               (projectile-project-root)
+                               current-prefix-arg)))
 
 (bind-key* "M-G" '(lambda ()
                     (interactive)
-                    (helm-grep-ag (helm-current-directory) current-prefix-arg)))
-
-(bind-key "M-i" 'helm-occur-from-isearch isearch-mode-map)
-
-(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)
-           ("C-h v" . helpful-variable)
-           ("C-h F" . helpful-command)
-           ("C-h M" . helpful-macro))
+                    (counsel-rg (thing-at-point 'symbol t)
+                                default-directory
+                                current-prefix-arg)))
+
+(require 'ivy-rich)
+(ivy-rich-mode 1)
+(setq ivy-format-function #'ivy-format-function-line
+      ivy-rich-path-style 'abbrev)
 
 (require 'smart-hungry-delete)
 (bind-keys ("<backspace>" . smart-hungry-delete-backward-char)

  (highlight-symbol-nav-mode)    ;; M-n, M-p
  (goto-address-prog-mode)
  (company-mode)
  ;; (semantic-mode 1)
  (bind-keys :map prog-mode-map
             ("<C-tab>" . company-complete)
             ("C-." . helm-semantic-or-imenu)))  ;; counsel-semantic-or-imenu)))

(add-hook 'text-mode-hook 'auto-fill-mode)
(add-hook 'text-mode-hook 'my-non-special-modes-setup)


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

(require 'ivy)
(ivy-mode 1)
(diminish 'ivy-mode)

(setq ivy-use-virtual-buffers t   ;; add recentf-mode and bookmarks
      ivy-initial-inputs-alist nil   ;; no regexp by default
      ivy-re-builders-alist '((t . ivy--regex-ignore-order))   ;; allow input not in order
      ivy-height 15
      ivy-count-format "(%d/%d) "
      swiper-action-recenter t
      )

(require 'counsel)
(bind-keys ("M-x" . counsel-M-x)
           ("C-x C-f" . counsel-find-file)
           ("C-h a" . counsel-apropos)
           ("C-h v" . counsel-describe-variable)
           ("C-h f" . counsel-describe-function)
           ("M-y" . counsel-yank-pop)
           ("C-c <SPC>" . counsel-mark-ring))

(bind-key "C-l" 'counsel-up-directory counsel-find-file-map)
(bind-key "M-i" '(lambda ()
                   (interactive)
                   (swiper (thing-at-point 'symbol t))))

;; TODO: pohledat obdobu helm-grep-save-buffer

(require 'projectile)
(setq projectile-enable-caching t)
(projectile-global-mode)
(setq projectile-completion-system 'ivy)
(bind-key "C-x C-p" 'counsel-projectile)

(diminish 'projectile-mode)
(add-to-list 'projectile-globally-ignored-files ".DS_Store")
