Coder Social home page Coder Social logo

linum-relative's Introduction

Emacs Logo

linum-relative.el

display relative line number in emacs.


License GPLv2 MELPA MELPA Stable

Screenshot

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:

     ;; 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.


Markdown README file generated by make-readme-markdown.el

linum-relative's People

Contributors

coldnew avatar ganneff avatar jfeltz avatar mgalgs avatar thierryvolpiatto avatar yorkz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linum-relative's Issues

Space between the number and the code

Hello,

Pardon my ignorance. How can I add an space between the line number and the code? I tried doing something like the following:

(defvar relative-linum-format-string "%3d ")

but it doesn't work. If you leave an space after the d when in emacs linum, it works, but then I don't get the relative numbers.

Thank you,

Adria

Solarized-theme doesn't have current line number highlighted

All other themes I enable have the current line number highlighted and different in color than the other numbers. I looked everywhere for the name of the face so I could customize it in Solarized theme but didn't find it. What is so special about Solarized that it overwrite? Ignore? highlighting the current line number. I would assume the theme has nothing to do with this since it is a linum-relative property?

Freeze the line numbers

Hi. Is there any way to freeze the line numbers, so that changing the current line does not change the numbers?

Package unmaintained

Hi:
This package looks to be unmaintained but also there is a substitution inside emacs introduced the last year: display-line-numbers with the "relative" value set. It is implemented in the display engine so it is very efficient.
Please, add a comment informing that in the readme in order to assert that new users get the newer/maintained alternative and the old users switch.

linum-relative-plusp-offset is being applied to negative line numbers

I want to use a different offset for negative line numbers but it looks like my value for linum-relative-plusp-offset is being applied to both positive and negative numbers.

Looking at the code, it looks like the abs call in diff1 is always causing minusp to return false in diff. If you perform the abs call after performing the minusp check instead of before and use that value further down for rendering, then that variable should work as intended.

Feature of linum-relative ?

Today I just find out emacs26 (commit: 5df239fc6ffbbb16ea6e5546fbec1508bf2cb4b7) now support display line numbers natively, which can make line number render quickly on large file.

Should we keep using linum.el as backend or use emacs 26's line-numbers functions when feature found?

PS: line-numbers already shipped relative line number function AFAIK, so maybe we just make linum-relative's function call line-numbers function and not use the linum.el ?

screen shot 2017-07-13 at 9 36 13 am

Show current line number instead of "0"

Hi, I want to know if is there some setting I could apply in order to show the current line number instead of just seeing a zero on the linum, for example:

3
2
1
4  This is the current line|
1
2
3

Thanks in advance!

linum-relative: Invalid function: with-helm-buffer

I updated linum-relative today, and whenever I open a new helm window, I get this.

linum-relative: Invalid function: with-helm-buffer

I don't want linum-relative in my helm buffers anyway, is there a way to turn this feature off?

I'm prety new to emacs, could someone tell me how to provide more debug info (if you need it)
I'm using the latest helm on melpa
Helm also updated today (so that might be the issue?)

Update linum-relatice doc

Since linum-relative will have some new feature, it's need to rewrite the README doc

  1. Show current line number on linum-relative
  2. Show both relative and current line number on fringe

visual-line-mode support?

When using visual-line-mode the line numbers reflect the physical lines in the file rather than the logical lines. Any chance of getting support for visual-line-mode? :)

Customize colors

I haven't been to customize the colors set by this plugin, and am a bit of a Emacs newbie so I'm not sure where to begin to look. I managed to change everything else I wanted and tried to change the colors, but couldn't get it to work.

This is how it looks: screen shot 2016-02-28 at 03 33 04. I don't want that black background on the current line, but not sure where to change it.

Use linum-relative along side with linum

Hi,

This mode is nice. Now I can effectively use my command with precise argument number. However, linum-relative disables linum if it is toggled. Can you make it appear next to linum, or appear on the right margin?

How to use linum-format with linum-relative?

Hi,
I would like to use linum-relative, but there is one issue with it.
When I set linum-format linum-relative stops working.
Without setting format edited text is "glued" with line number.

Command to turn on (and off) linum-relative

Hi,

I'm using Evil mode and I want to turn on linum-relative when I'm in the normal state, and turn it off wen I'm in the insert state. I'm using linum-relative-toggle as a hook, but it does not work precisely. Could you please provide linum-relative-on and linum-relative-offso I can turn it on/off without ambiguity?

Thank you so much!

The default fore/background of 'current-face' should be nil.

Imgur

The foreground and background of linum-relative-current-face should be set to nil both otherwise it seems imcompatible with most themes, e.g. solarized, zenburn. Also, I think nil is a better choice as a default value than :foreground "#CAE682" :background "#444444", isn't it?

Slow navigation when editing big org files

Hi.
When I open a big file with folded text using org-mode, linum-relative has to calculate the fold line numbers, which is very slow.

ss

Is it possible to add a variable to count only visible lines?

Actually, I don't know if that would make it fast.

Thanks.

New release

I'm packaging linum-relative for GNU Guix. It would be nice to have a new release. There hasn't been one in a long time despite many changes.

Show visual relative line numbers

linum-relative seems to be showing the relative numbers based on the actual or logical line numbers instead of visual lines.

screenshot from 2016-07-20 18-37-42

Eg. from the screenshot, currently we're on the TODO on line 12. The section heading 'Packages' is 27 lines below the current line. However, we can jump to it (using evil) directly using 3j since it's only 3 "visual" lines away.

Would it be possible to show the visual relative line numbers instead of the actual relative line numbers?

Thanks for a great plugin ๐Ÿ‘

Displaying Line Numbers with folded code.

When the code is folded there seems to be an issue where the folding of the lines is ignored. Is it the desired behaviour to not use visual lines.

Thank you for making an excellent and so useful package.

Kyle ๐Ÿ’ป.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.