7

Is it possible to change the column width in an emacs Ibuffer on the fly?

6

Change the value of ibuffer-formats to what you want, then switch back to the ibuffer window and press 'g'. ibuffer-update will notice the format change and do the right thing. C-h v ibuffer-formats RET will bring up documentation for the variable.

Example:

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

You could put this into your .emacs file for easy modification later. If you wanted the name column to be wider, you would edit your .emacs file and change the 18's above into something else:

(setq ibuffer-formats
      '((mark modified read-only " "
              (name 30 30 :left :elide) " "
              (size 9 -1 :right) " "
              (mode 16 16 :left :elide) " " filename-and-process)
        (mark " " (name 16 -1) " " filename)))

Then put the cursor on the line just after the above and type C-x C-e to evaluate the (setq ...) expression and the value of ibuffer-formats will be changed.

3
  • Thanks, could you include an example which makes clear which syntax to use for the ibuffer-formats variable? – student Apr 7 '12 at 8:16
  • I've added an example. – Kyle Jones Apr 7 '12 at 17:43
  • It's also possible to simply use customize to alter the ibuffer-formats variable for the current and future sessions. – vschum Jul 20 '16 at 17:34

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.