https://github.com/keegancsmith/counsel-repo
Emacs jump to repository using Ivy
https://github.com/keegancsmith/counsel-repo
counsel emacs emacs-lisp ivy
Last synced: 4 months ago
JSON representation
Emacs jump to repository using Ivy
- Host: GitHub
- URL: https://github.com/keegancsmith/counsel-repo
- Owner: keegancsmith
- License: mit
- Created: 2018-09-04T01:27:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-12T12:50:18.000Z (about 2 years ago)
- Last Synced: 2024-12-28T15:27:38.389Z (6 months ago)
- Topics: counsel, emacs, emacs-lisp, ivy
- Language: Go
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# counsel-repo
Jump to repository using [ivy](https://github.com/abo-abo/swiper).

## Installation
Make sure `counsel-repo.el` is in your `load-path` and then:
``` emacs-lisp
(require 'counsel-repo)
```Additionally ensure `counsel-repo` is installed onto your `$PATH`:
``` shellsession
$ go get github.com/keegancsmith/counsel-repo
```## Configuration
By default counsel-repo will search `~/src` (or `$SRCPATHS` if set) and will
open results in dired. An example configuration which opens results in `magit`
and searches both `~/src` and `~/go/src`:``` emacs-lisp
(setq
counsel-repo-srcpaths '("~/go/src" "~/src")
counsel-repo-action #'magit-status)
```## How it works
[counsel-repo.go](./counsel-repo.go) recursively searches for all paths
containing `.git/HEAD`, returning the paths sorted by the `HEAD` file
mtime. mtime of `HEAD` is used since it is a good indicator for how recently
the repository was used / updated.The finder is written in Go for performance reasons. For example an equivalent
shell version on my laptop takes 1.29s vs 0.08s of counsel-repo:``` shellsession
$ /usr/bin/time find ~/go/src ~/src -type d -exec /bin/test -d '{}/.git' \; -print -prune > /dev/null
1.29 real 0.46 user 0.64 sys
$ /usr/bin/time counsel-repo ~/go/src ~/src > /dev/null
0.08 real 0.01 user 0.05 sys
```