16

Is there a way to customize the widths of the columns in ibuffer? Specifically, I want to widen the Name column to be able to read more of the buffer names before they get truncated. I have tried Buffer-menu-name-width, but it seems that the Buffer-menu variables are not used by ibuffer. I have also tried M-x customize-group RET ibuffer RET but nothing seemed relevant.

16

As @Sigma's answer mentions, you need to customize ibuffer-formats. The docstring gives a lot of details about how to modify it by hand, and also notes that you can use the customize machinery to tinker with it. If you prefer the elisp approach, you can adapt the default settings to your taste, with the numbers after the name component of the list referring to the minimum and maximum width of the columns. So, changing the column to which the name field spans from the default of 18 to 30 can be achieved by:

;; nearly all of this is the default layout
(setq ibuffer-formats 
      '((mark modified read-only " "
              (name 30 30 :left :elide) ; change: 30s were originally 18s
              " "
              (size 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " " filename-and-process)
        (mark " "
              (name 16 -1)
              " " filename)))
  • It looks like even when you use the customize interface you still end up writing (or modifying) elisp forms to do the customizing. – nispio Oct 2 '14 at 20:18
5

You can customize ibuffer-formats, which allows you to define amongst other things the width of the columns. It also allows you to define several formats, which is convenient for the stuff that you don't want to always display.

2

If what you care about is seeing the entire buffer-name column, specifically, you can do it without "customising" anything, by using ibuffer-switch-format, bound to ` within ibuffer.

The function switches between the alternatives specified by ibuffer-formats. By defaults ibuffer-formats has two options:

((mark modified read-only locked " "
       (name 18 18 :left :elide)
       " "
       (size 9 -1 :right)
       " "
       (mode 16 16 :left :elide)
       " " filename-and-process)
 (mark " "
       (name 16 -1)
       " " filename))

of which the second does not constrain the width of the name column.

In the general case, customize is needed, as specified in the answers by Sigma and Dan.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.