1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
# ibuffer-projectile: Group buffers in ibuffer list by projectile project #
Emacs' `ibuffer-mode` is a wonderful replacement for the built-in
`list-buffer` command, and allows buffers to be grouped
programatically, e.g. by major mode.
`ibuffer-projectile` lets you group your buffers by their projectile
root directory.
You can use this package manually or automatically. For manual use,
call `ibuffer-projectile-set-filter-groups`. To have this function
called when you open ibuffer, add this hook to your configuration:
```el
(add-hook 'ibuffer-hook
(lambda ()
(ibuffer-projectile-set-filter-groups)
(unless (eq ibuffer-sorting-mode 'alphabetic)
(ibuffer-do-sort-by-alphabetic))))
```
Alternatively, use `ibuffer-projectile-generate-filter-groups'
to programmatically obtain a list of filter groups that you can
combine with your own custom groups.
To display filenames relative to the project root, use project-relative-file
in `ibuffer-formats`, e.g.:
```el
(setq ibuffer-formats
'((mark modified read-only " "
(name 18 18 :left :elide)
" "
(size 9 -1 :right)
" "
(mode 16 16 :left :elide)
" "
project-relative-file)))
```
I personally use [ibuffer-vc](https://github.com/purcell/ibuffer-vc)
because I prefer its grouping behaviour, but I thought this would be
useful to some people too.
## How to install ##
Add `ibuffer-projectile.el` to your `load-path`, or (preferred) install from [Melpa][Melpa].
[Melpa]: http://melpa.org "Melpa"
<hr>
[![](http://api.coderwall.com/purcell/endorsecount.png)](http://coderwall.com/purcell)
[![](http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.png)](http://uk.linkedin.com/in/stevepurcell)
[Steve Purcell's blog](http://www.sanityinc.com/) // [@sanityinc on Twitter](https://twitter.com/sanityinc)
|