Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Quick access to project files in Emacs
Emacs Lisp
branch: master
Failed to load latest commit information.
README.org fixed typo
find-file-in-project.el fixed typo

README.org

find-file-in-project (v3.5)

Find files in a project quickly.

This program provides a couple methods for quickly finding any file in a given project. It depends on GNU find.

By default, it will automatically search file in project managed by Git. But you can easily switch to other types of projects.

Features:

  • The only dependency is GNU find
  • Works on Windows/Cygwin/Linux/Mac
  • Furthing tweaking of GNU find through flag `ffip-find-options` is possible

Install

Please install through melpa

Setup

It works out of the box for project using Git.

If you use other VCS (subversion, for example), insert below line into ~/.emacs:

(setq ffip-project-file ".svn")

Usage

  • `M-x find-file-in-project` starts search immediately
  • `M-x find-file-in-project-by-selected` use the selected region as keyword to search. If no region selected, you need input the keyword

Tips

APIs

  • “ffip-get-project-root-directory” return the full path of current project

Per project setup

;; if the full path of current file is under SUBPROJECT1 or SUBPROJECT2
;; OR if I'm reading my personal issue track document,
(when (ffip-current-full-filename-match-pattern-p "\\(/SUBPROJECT1\\|/SUBPROJECT2\\|issue-track.org\\)")
  ;; set the root directory into "~/projs/PROJECT_DIR"
  (setq-local ffip-project-root ("~/projs/PROJECT_DIR"))
  ;; well, I'm not interested in concatenated BIG js file or file in dist/
  (setq-local ffip-find-options "-not -size +64k -not -iwholename '*/dist/*'")
  ;; for this project, I'm only interested certain types of files
  (setq-local ffip-patterns '("*.html" "*.js" "*.css" "*.java" "*.xml" "*.js")))

Specify root directory on Cygwin&Windows

(if (eq system-type 'windows-nt)
    (setq ffip-project-root "C:/Users/myname/projs/myproj1")
  (setq ffip-project-root "~/projs/myprojs1"))

Performance

This program is tested with 50,000+ files (Linux Kernel, for example) without any performance issue.

But it could be more responsive if you follow EITHER of following suggetions:

Suggestion 1, Install Swiper and insert below code into your ~/.emacs:

(autoload 'ivy-read "ivy")

Then Swiper’s UI ivy will be used. That’s all you need to do.

Suggestion 2, If you don’t like Swiper, the default Ido will be used. It might be slow for 50K files. The issue could be easily resolved by installing flx-ido. Flx-ido also replaces Ido’s default matching algorithm with a much better one. So it’s highly recommended to use it.

Bug Report

Check https://github.com/technomancy/find-file-in-project

Something went wrong with that request. Please try again.