Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have emacs-helm list offer files in current directory as options?

Tags:

emacs

Is there a way from the helm-mini command to list includes files in the current directory as part of potential search matches?

like image 301
Terrence Brannon Avatar asked Jul 09 '12 22:07

Terrence Brannon


1 Answers

You'll find helm-mini defined as:

(defun helm-mini ()
  "Preconfigured `helm' lightweight version \(buffer -> recentf\)."
  (interactive)
  (helm-other-buffer '(helm-c-source-buffers-list
                       helm-c-source-recentf
                       helm-c-source-buffer-not-found)
                     "*helm mini*"))

so it just calls with a list of sources. It's very easy to add any existing source.

With helm-mode enabled run C-h vhelm-c-source files (note space) and you should find:

helm-c-source-files-in-current-dir

So make your own helm command with the sources you need:

(defun helm-my-buffers ()
  (interactive)
  (helm-other-buffer '(helm-c-source-buffers-list
                       helm-c-source-files-in-current-dir
                       helm-c-source-recentf
                       helm-c-source-buffer-not-found)
                     "*helm-my-buffers*"))

Check out the definition of helm-for-files-prefered-list for other sources that might interest you. And use the help system to discover new goodies.

like image 57
event_jr Avatar answered Nov 02 '22 13:11

event_jr