This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+emacs/ibuffer/packages.el

55 lines
1.7 KiB
EmacsLisp
Raw Normal View History

2015-04-20 17:44:44 +00:00
;;; packages.el --- ibuffer Layer packages File for Spacemacs
;;
2018-01-04 07:00:25 +00:00
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
2015-04-20 17:44:44 +00:00
;;
;; Author: Aleksandr Guljajev <aleksandr.guljajev@gmail.com>
2015-04-20 17:44:44 +00:00
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq ibuffer-packages
'(
ibuffer
ibuffer-projectile
))
2015-04-20 17:44:44 +00:00
(defun ibuffer/init-ibuffer()
(use-package ibuffer
:defer t
2015-04-20 17:44:44 +00:00
:init
(progn
(spacemacs/set-leader-keys "bI" 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(defun spacemacs//ibuffer-group-by-modes ()
"Group buffers by modes."
(when (eq 'modes ibuffer-group-buffers-by)
(spacemacs//ibuffer-create-buffs-group)))
2015-09-28 20:37:58 +00:00
(add-hook 'ibuffer-hook 'spacemacs//ibuffer-group-by-modes)
;; Use ibuffer to provide :ls
(evil-ex-define-cmd "buffers" 'ibuffer))
2015-09-27 13:19:31 +00:00
:config
(evilified-state-evilify-map ibuffer-mode-map
:mode ibuffer-mode
:bindings
"gr" 'ibuffer-update
"gj" 'ibuffer-forward-filter-group
"]" 'ibuffer-forward-filter-group
"gk" 'ibuffer-backward-filter-group
"[" 'ibuffer-backward-filter-group)))
2015-04-20 17:44:44 +00:00
(defun ibuffer/init-ibuffer-projectile()
(use-package ibuffer-projectile
:defer t
2015-04-20 17:44:44 +00:00
:init
(progn
(defun spacemacs//ibuffer-group-by-projects ()
"Group buffers by projects."
(when (eq 'projects ibuffer-group-buffers-by)
(ibuffer-projectile-set-filter-groups)
(unless (eq ibuffer-sorting-mode 'alphabetic)
(ibuffer-do-sort-by-alphabetic))))
(add-hook 'ibuffer-hook 'spacemacs//ibuffer-group-by-projects))))