https://github.com/tarao/anything-git-files-el.git
git clone 'git://github.com/tarao/anything-git-files-el.git'
M-x package-install RET anything-git-files RET
.M-x el-get RET anything-git-files RET
(:name anything-git-files
:type github
:pkgname "tarao/anything-git-files-el"
:depends anything)
Load anything-git-files.el in your ~/.emacs or ~/emacs.d/init.el:
lisp
(require 'anything-git-files)
Then, M-x anything-git-files
will list the files in a git
repository. Note that M-x anything-git-files
will fail when the
file of the current buffer is not in a git repository.
The anything sources to get files in a git repository are
anything-git-files:modified-source
,
anything-git-files:untracked-source
and
anything-git-files:all-source
.
The list of anything sources for submodules can be retrieved by
function anything-git-files:submodule-sources
. The function takes
one argument, which is a list of symbols of source type, modified
,
untracked
or all
. For example,
(anything-git-files:submodule-sources '(untracked all)
returns
anything sources for untracked files and all files in the git
repository of the submodules.
The following example defines a custom anything function to
list files from several sources, including ones from
anything-git-files.el.
lisp
(defun tarao/anything-for-files ()
(interactive)
(require 'anything-config)
(require 'anything-git-files)
(let* ((git-source (and (anything-git-files:git-p)
`(anything-git-files:modified-source
anything-git-files:untracked-source
anything-git-files:all-source
,@(anything-git-files:submodule-sources 'all))))
(other-source '(anything-c-source-recentf
anything-c-source-bookmarks
anything-c-source-files-in-current-dir+
anything-c-source-locate))
(sources `(anything-c-source-buffers+
anything-c-source-ffap-line
anything-c-source-ffap-guesser
,@git-source
,@other-source)))
(anything-other-buffer sources "*anything for files*")))