Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I adjust the left margin in Emacs (noX)?

Tags:

emacs

Currently the text is right up against the left edge of the terminal window, which is somewhat annoying. I would like there to be a small margin, without line numbers, or a visual line. I am aware of the fringes, however fringe-mode only seems to work in the GUI version. Ideally, I would like the margins to be adjusted on the fly, depending on the window size, to center the text body of a particular width, which is then filled properly.

like image 424
qubital Avatar asked Aug 31 '11 01:08

qubital


1 Answers

You could add the following to your Emacs init file to add a 2 character margin (change to suit) to the left and right sides of every window:

(add-hook 'window-configuration-change-hook
          (lambda ()
            (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 2 2)))

This works in a terminal Emacs.

like image 150
zev Avatar answered Sep 20 '22 07:09

zev