0


I use this plugin relative-line-numbers of Fanael on Github. how to add extra spaces on the both sides of the relative number sides?

Form this

enter image description here

To this

enter image description here

1 Answer 1

1

From the documentation:

relative-line-numbers-format is a variable defined in ‘relative-line-numbers.el’. Its value is relative-line-numbers-default-format

Documentation:
The function used to format the line numbers. The function should take one integer argument: the line’s distance, in lines, from the current line, and return a string.

You can customize this variable.

You will have first to define somewhere in your configuration file, a function to use for formatting, for example:

(defun my-relative-line-numbers-default-format (offset)
  "The default formatting function.                                                                                        
Return the absolute value of OFFSET, converted to string."
  (concat " - " (number-to-string (abs offset)) " + "))

Then, you will have to call M-x customize-variable then type relative-line-numbers-format. You'll be shown a window inside with you can change the name of the function used for formatting, use your custom function defined above. Then you'll have to apply and save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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