 ;;------------;;
 ;; Simplify navigation of files for a project
 (use-package projectile)
-(use-package counsel-projectile
-             :bind ("C-x F" . counsel-projectile-find-file))
+(use-package counsel-projectile)
 ;; Simplify navigation between buffers
 (use-package ace-window
-             :bind ("M-o" . ace-window)
-             :config
-             (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
-             (setq aw-background nil))
+  :config
+  (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+  (setq aw-background nil))
 
 
 ;;-----;;

;;------------------------------------------------;;
(defun magit-status-autorefresh (callee)
  (interactive)
  (let ((project-previous (magit-toplevel)))
    (call-interactively callee)
    (let ((project (magit-toplevel)))
      (when (and project
                 (not (equal project-previous project)))
        (let ((status-win
               (cl-some (lambda (b)
                          (and (with-current-buffer b
                                 (derived-mode-p 'magit-status-mode))
                               (get-buffer-window b 'visible)))
                        (buffer-list)))
              (magit-display-buffer-noselect t)
              (magit-display-buffer-function
               (lambda (buffer)
                 (display-buffer buffer '(display-buffer-same-window)))))
          (when status-win
            (with-selected-frame (window-frame status-win)
              (with-selected-window status-win
                (magit-status-internal project))))))))
  )

(defun my/other-window ()
  (interactive)
  (magit-status-autorefresh 'other-window)
  )

(defun my/other-ace-window ()

  ("C-x g" . magit-status)
  ("C-c C-g b" . magit-blame)
  ("C-x o" . my/other-window)
  ("C-x F" . my/other-counsel-projectile-find-file)
  ("C-x C-f" . my/other-find-file)
  ("M-o" . my/other-ace-window)
  :config
  (add-hook 'after-save-hook 'magit-after-save-refresh-status)
