Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coldnew/linum-relative
display relative line number in the left margin in emacs
https://github.com/coldnew/linum-relative
display-line-numbers-mode emacs emacs-lisp linum linum-mode melpa
Last synced: about 1 month ago
JSON representation
display relative line number in the left margin in emacs
- Host: GitHub
- URL: https://github.com/coldnew/linum-relative
- Owner: coldnew
- Created: 2012-01-31T11:51:28.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2022-10-25T05:17:15.000Z (about 2 years ago)
- Last Synced: 2024-12-09T18:39:53.688Z (about 2 months ago)
- Topics: display-line-numbers-mode, emacs, emacs-lisp, linum, linum-mode, melpa
- Language: Emacs Lisp
- Homepage:
- Size: 278 KB
- Stars: 169
- Watchers: 11
- Forks: 19
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## linum-relative.el
*display relative line number in emacs.*---
[![License GPLv2](https://img.shields.io/badge/license-GPL_v2-green.svg)](http://www.gnu.org/licenses/gpl-2.0.html)
[![MELPA](http://melpa.org/packages/linum-relative-badge.svg)](http://melpa.org/#/linum-relative)
[![MELPA Stable](http://stable.melpa.org/packages/linum-relative-badge.svg)](http://stable.melpa.org/#/linum-relative)![Screenshot](https://github.com/coldnew/linum-relative/raw/master/screenshot/screenshot1.jpg)
linum-relative lets you display relative line numbers for current buffer.
### Installation
If you have `melpa` and `emacs24` installed, simply type:
M-x package-install linum-relative
And add the following to your .emacs
(require 'linum-relative)
### Setup & Tips
The non-interactive function *linum-on* (which should already be built into recent GNU Emacs distributions), turns on side-bar line numbering:
(linum-on)
and alternatively, by using command:
M-x linum-relative-mode
Relative line numbering should already be enabled by default (by installing this package), following *linum-on* or enabling *linum-mode*. One can also use the *linum-relative-toggle* interactive function to switch between relative and non-relative line numbering:
M-x linum-relative-toggle
### Backends
By default, linum-relative use *linum-mode* as backend, since linum-mode is based on emacs-lisp, you may have performance issue on large file.
Since linum-relative 0.6, if you also use emacs version 26.1 or above, you can setup `linum-relative-backend` to make linum-relative-mode use `display-line-number-mode` as backend, which is implement in C so the performance is really nice.
However some linum-relative's customize function may not work propely.
Here's how to use `display-line-number-mode` as backend:
```elisp
;; Use `display-line-number-mode` as linum-mode's backend for smooth performance
(setq linum-relative-backend 'display-line-numbers-mode)
```### Customization Documentation
#### `linum-relative-current-symbol`
The symbol you want to show on the current line, by default it is 0.
You can use any string like "->". If this variable is empty string,
linum-releative will show the real line number at current line.This won't take effect if you choose `display-line-numbers-mode` backend.
#### `linum-relative-plusp-offset`
Offset to use for positive relative line numbers.
This won't take effect if you choose `display-line-numbers-mode` backend.
#### `linum-relative-format`
Format for each line. Good for adding spaces/paddings like so: " %3s "
This won't take effect if you choose `display-line-numbers-mode` backend.
#### `linum-relative-lighter`
Lighter of linum-relative-mode
#### `linum-relative-backend`
The default backend for `linum-relative`, by default we use
`linum-mode` (slow), you can switch to `display-line-numbers-mode` if
you has emacs-version greater than 26.0.50.### Function and Macro Documentation
#### `(linum-relative-in-helm-p)`
Return non nil when in an helm session.
#### `(linum-relative-on)`
Turn ON linum-relative.
#### `(linum-relative-off)`
Turn OFF linum-relative.
#### `(linum-relative-toggle)`
Toggle between linum-relative and linum.
-----