(require 'ibuffer)

(require 'ibuffer-vc)

(defun ibuffer-set-up-preferred-filters ()
  (ibuffer-vc-set-filter-groups-by-vc-root)
  (ibuffer-do-sort-by-filename/process))
(add-hook 'ibuffer-mode-hook 'ibuffer-set-up-preferred-filters)




;; Use human readable Size column instead of original one
(define-ibuffer-column size-h
  (:name "Size" :inline t)
  (cond
   ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
   ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
   (t (format "%8d" (buffer-size)))))


;; Modify the default ibuffer-formats
(setq ibuffer-formats
      '((mark modified read-only vc-status-mini " "
              (name 18 18 :left :elide)
              " "
              (size-h 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " "
              (vc-status 16 16 :left)
              " "
              filename-and-process)))


(global-set-key (kbd "C-x C-b") 'ibuffer)

(provide 'init-ibuffer)

(require 'ibuffer)

(require 'ibuffer-vc)

(defun ibuffer-set-up-preferred-filters ()
  (ibuffer-vc-set-filter-groups-by-vc-root)
  (ibuffer-do-sort-by-filename/process))
(add-hook 'ibuffer-mode-hook 'ibuffer-set-up-preferred-filters)




;; Use human readable Size column instead of original one
(define-ibuffer-column size-h
  (:name "Size" :inline t)
  (cond
   ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
   ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
   (t (format "%8d" (buffer-size)))))


;; Modify the default ibuffer-formats
(setq ibuffer-formats
      '((mark modified read-only vc-status-mini " "
              (name 18 18 :left :elide)
              " "
              (size-h 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " "
              (vc-status 16 16 :left)
              " "
              filename-and-process)))


(global-set-key (kbd "C-x C-b") 'ibuffer)

(provide 'init-ibuffer)

Fix size-h ibuffer column definition borrowed from elsewhere, which was incorrect
Fix size-h ibuffer column definition borrowed from elsewhere, which was incorrect

exclamaforte/emacs.d,whizzzkid/emacs.d,scorpionis/emacs.d,LKI/emacs.d,mpwang/emacs.d,carlosliu/emacs.d,zuoshifan/emacs.d,Guoozz/emacs.d,farzadbekran/emacs.d,Werewolflsp/emacs.d,braveoyster/emacs.d,YangXin/emacs.d,Enzo-Liu/emacs.d,qinshulei/emacs.d,ruiyang/emacs.d,mmqmzk/emacs.d,Togal/emacs.d,farzadbekran/emacs.d,cjqw/emacs.d,hophacker/emacs.d,cyjia/emacs.d,lromang/emacs.d,kindoblue/emacs.d,zuoshifan/emacs.d,zuoshifan/emacs.d,jhpx/emacs.d,zuoshifan/emacs.d,farzadbekran/emacs.d,kongfy/emacs.d,wenpincui/emacs.d,wegatron/emacs.d,Jadecity/PurcellEmacs.d,baohaojun/emacs.d,renatoriccio/emacs.d,svenyurgensson/emacs.d,sgarciac/emacs.d,dhanunjaya/emacs.d,zhuoyikang/emacs.d,me020523/emacs.d,roxolan/emacs.d,gsmlg/emacs.d,arthurl/emacs.d,zuoshifan/emacs.d,zenith-john/emacs.d,blueseason/emacs.d,farzadbekran/emacs.d,farzadbekran/emacs.d,jkaessens/emacs.d,jachinpy/emacs.d,hkcqr/emacs.d,alant/emacs.d,zuoshifan/emacs.d,zhaotai/.emacs.d,fengxl/emacs.d,jachinpy/emacs.d,Shanicky/emacs.d,bibaijin/emacs.d,boblannon/emacs.d,lujianmei/emacs.d,benkha/emacs.d,DarkThrone/emacs.d,LittleLmp/emacs.d,caoyuanqi/emacs.d,pairyo/emacs.d,purcell/emacs.d,emuio/emacs.d,lust4life/emacs.d,46do14/emacs.d,ernest-dzf/emacs.d,zuoshifan/emacs.d,jthetzel/emacs.d,dongdonghu/.emacs.d,ilove0518/emacs.d,danfengcao/emacs.d,haodaivshen/emacs.d,YangXin/emacs.d,shafayetkhan/emacs.d,zuoshifan/emacs.d,modkzs/emcs.d,krzysz00/emacs.d,atreeyang/emacs.d,dcorking/emacs.d,blueabysm/emacs.d,qianwan/emacs.d,ruiyang/emacs.d,zuoshifan/emacs.d