 (defun find-file-fuzzy ()
   "Use ido to a pick a file anywhere in the current project."
   (interactive)
+  (when (not default-directory) (error "This buffer isn't associated with a file"))
   (let* ((ido-enable-flex-matching nil) ; required for acceptable performance (over 1000 items)
          (search-directory (file-find-project-root default-directory))
-         (file-names (or (git-list-files search-directory)
-                         (list-files-recursive search-directory))))
+         (file-names (or (list-files-recursive-git search-directory)
+                         (list-files-recursive-svn search-directory)
+                         (list-files-recursive-generic search-directory))))
     (find-file
      (file-path-join
       search-directory


(autoload 'shell-command-to-string-in-dir "shell-utils")

(defun git-list-files (directory)
  "Recursively list all the files in DIRECTORY, assuming
DIRECTORY is in a git repo. Return nil otherwise."
  (when (vc-git-root directory)
    (split-string
     (shell-command-to-string-in-dir "git ls-files" directory) "\n" t)))

(defun list-files-recursive (directory)
  "Recursively list all the files in DIRECTORY, ignoring .svn directories."
  (split-string
   (shell-command-to-string-in-dir "find . -type f -not -iwholename '*.svn*' | sed \"s|^\./||\"" (message directory))
   "\n" t))

(autoload 'file-find-project-root "file-utils")


(global-set-key (kbd "C-x C-g") 'find-file-fuzzy)

(provide 'file-customisations)
