I have a growing set of org files stored in org-directory
. How can I navigate between them, preferably with interactive filtering and completion?
I thought there was a way to get org-mode to produce a list of known org files for quick navigation, but I can't seem to find it. If org-mode does not have this feature, how can I make a simple command that launches something like helm or icicles to find them?
The question is not very clear to me. But if your Org-mode files all have a certain file-name pattern (eg *.org
) and all are in the same directory ( org-directory
) then you can use several methods Emacs method to access them:
Cx Cf *.org RETURN
in org-directory
opens them all (the buffers are visiting them but only the last one is shown).
Cx Cf *.org TAB
in org-directory
, to show them using completion, then pick whichever one you want (or pick more than one, using a glob pattern, as in #1).
The same as #2, using Icicles or Helm. In Icicles, at least, you can also match using regexps and in other ways.
Open Dired for just those files: Cx d *.org
.
There are really any number of ways to do what you've described. But I'm guessing that you have not really described your request/problem/question well enough, and when you do you will get a narrower set of answers.
UPDATE after your comments:
Here's one way: Open Dired on all of your Org files in and under org-directory
.
(defun foo ()
"Open Dired for (only) the Org files in and under `org-directory`."
(interactive)
(cd org-directory)
(dired "*.org" "-lRF"))
Test it with Mx foo
. Put this in your init file:
(foo)
And here's another way: Mx bar
or bind bar
to a key.
(defun bar ()
"Open an Org file in or under `org-directory`."
(interactive)
(let ((default-directory org-directory)
(icicle-file-match-regexp ".*\\.org"))
(icicle-locate-file-of-content)))
I have a package that does just that: plain-org-wiki . It's nothing too elaborate: I just dump all of my 45 org files into a single directory and get completion for them.
How about org-iswitchb , which is provided by org already?
S witch between Org buffers. With one prefix argument, restrict available buffers to files. With two prefix arguments, restrict available buffers to agenda files .
Add this to your startup file after org is loaded: (global-set-key "\\C-cb" 'org-iswitchb)
My favorite solution to this is helm-mode
which is activated with the helm
package from MELPA. Here's a demo:
It really makes for a great environment for searching ones files quickly. In addition, one can enable fuzzy completion! Here's a minimal configuration (after installing the helm
package):
(require 'helm-config)
(helm-mode 1)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
You can also run grep
on the files if you'd like to search their content. Take a look at this amazing guide if you'd like to learn more.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.