2

I want to have a solid line seperating the line numbers from the text in linum mode. I have tried following this guide and have this code in my .emacs

http://www.emacswiki.org/emacs/LineNumbers#toc8

;If you want a solid line separator, try something like this:
(setq linum-format "%4d \u2502 ")

with the end result being.

enter image description here

If I am not mistaken that is not a solid line it is a bunch of aligned bars. I want a solid grey line with specified thickness if that is possible.

marked as duplicate by Scott Weldon, Drew, Gilles, erikstokes, Andrew Swann Jun 27 '15 at 7:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    How about setting the width of the fringe and making that whatever color you want? That is the preferred method in my opinion, and you can do away with that pipe code stuff. – lawlist Jun 26 '15 at 3:33
  • Could you give an example on how to that ? I am not really sure what you mean. – Mohamed Abdelkhalek Jun 26 '15 at 12:33
1

The following example sets fringe widths globally for all new frames that will be created. I like face-spec-set, but the recommended approach is to use set-face-attribute or M-x customize-face to control color. The width is adjustable to create a thin or thick vertical line on either side of the window.

(add-to-list 'default-frame-alist '(left-fringe . 8))

(add-to-list 'default-frame-alist '(right-fringe . 8))

(face-spec-set 'fringe
  '((((class color) (background light))
     :background "red")
    (((class color) (background dark))
     :background "yellow")
    (t
     :background "cyan")))

The following is a reprint of a prior post of mine in another forum relating to this issue: https://emacs.stackexchange.com/a/5310/2287

There are a few ways to do this -- my preferred method is to set the frame defaults for the fringes:

(set-face-attribute 'fringe nil :background "red")
(add-to-list 'default-frame-alist '(left-fringe . 11))
(add-to-list 'default-frame-alist '(right-fringe . 0))

It is possible to set the windows fringes globally:

(setq-default left-fringe-width 11)
(setq-default right-fringe-width 0)

It is also possible to set the windows fringes locally:

(setq left-fringe-width 11)
(setq right-fringe-width 0)

Here is the doc-string for left-fringe-width and right-fringe-width:

Automatically becomes buffer-local when set.

Documentation:
Width of this buffer's left/right fringe (in pixels).
A value of 0 means no left/right fringe is shown in this buffer's window.
A value of nil means to use the left/right fringe width from the window's frame.

Setting this variable does not take effect until a new buffer is displayed
in a window.  To make the change take effect, call `set-window-buffer'.

Example

  • I used to do this, but it bothered me that there was no gap between the fringe and the buffer contents. Is there any way to fix that? – PythonNut Jun 26 '15 at 22:41
  • @PythonNut -- not easily, but technically speaking yes/no :) using overlays -- it will not be very efficient -- e.g., vertical-motion over every screen line in the visible window to calculate point at beginning of visually wrapped lines (not necessarily point-at-bol) -- every visually wrapped line and every beginning of line could receive a stretch-glyph/spacer. Expanding that idea to the whole buffer is impractical. I prefer to just make the fringe background match the 'default background (so the fringe is essentially invisible) and use that as my spacer between the line numbers. – lawlist Jun 26 '15 at 23:37

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