Skip to content

tarao/anything-git-files-el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 

Repository files navigation

anything-git-files.el --- anything for git files

M-x anything-git-files

Features

  • List all the files in a git repository which the file of the current buffer belongs to
    • List untracked files and modified files in different sources
  • List files in the submodules
  • Cache the list as long as the repository is not modified
  • Avoid interrupting user inputs; external git command is invoked asynchronously

Install

Manual Install

  1. Install dependent package anything.el
  2. Locate anything-git-files.el in your load path

Install by MELPA

  1. Type M-x package-install RET anything-git-files RET.

Install by el-get

  1. Save the lines below as anything-git-files.rcp in your recipe directory
  2. Type M-x el-get RET anything-git-files RET
(:name anything-git-files
       :type github
       :pkgname "tarao/anything-git-files-el"
       :depends anything)

Usage

Load anything-git-files.el in your ~/.emacs or ~/emacs.d/init.el:

(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.

Customization

Hack the anything sources

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.

(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*")))

See Also

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published