 (require 's)
 (require 'f)
 
-(defvar ar/counsel-find--paths nil "Find path.")
-
-(defvar ar/counsel-find--args nil "Find argumetns.")
+(defvar ar/counsel-find--paths nil
+  "Find in paths.")
+
+(defvar ar/counsel-find--args nil
+  "Find arguments.")
 
 (defvar ar/counsel-find--history nil "History for `ar/counsel-find'.")
 

                                                               (region-end)))
              :dynamic-collection t
              :history 'ar/counsel-find--history
              :action (lambda (file)
                        (with-ivy-window
                          (when file
                            (find-file file))))
              :unwind #'counsel-delete-process
              :keymap kmap
              :caller 'ar/counsel-find)))

(defun ar/counsel-find--command ()
  (format "find %s %s "
          (s-join " " ar/counsel-find--paths)
          ar/counsel-find--args))

(defun ar/counsel-find--function (pattern)
  "Find files ivy function matching PATTERN."

  (or
   (ivy-more-chars)
   (progn
     (counsel--async-command (ar/counsel-find--command)
                             #'ar/counsel-find--async-sentinel
                             #'ar/counsel-find--async-filter)
     '("" "working..."))))

;; Like `find-dired' but taking a list of directories.
;; Mostly copied from find-dired.el.
(defun ar/counsel-find--dired (dpaths args)
  "Run `find' and go into Dired mode on a buffer of the output.
The command run is essentially: find DPATHS \\( ARGS \\) -ls"
  (assert (> (length dpaths) 0) nil "Needs at least one directory path to find from")
  (let ((dired-buffers dired-buffers)
        (command))
    (pop-to-buffer-same-window (get-buffer-create "*Find*"))
    (setq default-directory (file-name-as-directory
                             (expand-file-name (if (= (length dpaths) 1)
                                                   (nth 0 dpaths)
                                                 (f-common-parent dpaths)))))
    ;; Kill exsiting `find' process.
    (when (and (get-buffer-process (current-buffer))
               (eq (process-status (get-buffer-process (current-buffer)))
