Questions tagged [line-numbers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
2answers
651 views

Emacs relative and absolute line number at the same time?

I don't mean hybrid line number mode, I want the absolute line number appears for all the lines, not only the current line number.
7
votes
2answers
2k views

Any way to get a working separator line between fringe/line numbers and the buffer?

is there any way to get a separator like the one for the split buffers (line in the middle of the image) for the line numbers/fringe? I tried (setq linenum-format "%4d \u2502 ") but that gives me a ...
3
votes
1answer
254 views

How to change line-number gutter width using display-line-numbers mode?

I am using (global-display-line-numbers-mode 1) in my init.el file and everything is working as expected. The only problem is that I find the gutter width to be too wide and would prefer it to match ...
1
vote
1answer
66 views

Add paragraph numbers

I have a longish document and I want to number the paragraphs. So, Here is the first paragraph. It could span multiple visual lines. Two paragraphs are separated by an empty line. converts to : 1 ...
3
votes
1answer
136 views

Setting relative line numbers when in programming modes

Looking to set relative line numbers when in programming modes. Looking through the older posts I see a way to set line numbers based on the mode - How do I display line numbers in emacs (not in the ...
1
vote
0answers
51 views

Huge buggy padding in line-number buffer

A picture: As you can see there is a huge waste of space on the left side of the line number section. When I increase the font size the padding even increases and does not decrease when I decrease ...
27
votes
5answers
19k views

How do I display line numbers in emacs (not in the mode line)?

I know how to display line numbers (and columns) in the mode-line, but I'd like emacs to display the line numbers for all the lines on the left-hand side. I've seen this done in vim and other text ...
0
votes
1answer
37 views

auto-start of linum mode doesn't work

I'm currently using spacemacs. I have put the line (global-linum-mode t) into the .spacemacs file but it doesn't work at all. It used to work when I used the normal emacs. I don't have any clue of ...
3
votes
0answers
64 views

Are zero-based column numbers an Emacs idiosyncrasy?

The first line of a text file is line number 1 in probably every application I have ever come across, including Emacs. Every application I have at hand also uses column number 1 for the first column ...
0
votes
3answers
77 views

How to display absolute line numbers of a full, widened buffer when narrowing to just part of it?

This question applies in the context of all line numbering implementations I've tried, including line-number, nlinum, and linum, so I have a feeling that the answer will have something to do with ...
0
votes
1answer
79 views

Line numbers break scroll margin

I'm trying to set a scroll margin to emacs with the scroll-margin variable, but I've noticed that when you do that and you have display-line-numbers-mode enabled, the scrolling doesn't work properly ...
0
votes
1answer
98 views

Elisp program to insert line numbers into a buffer?

I am NOT looking for emacs's line-number mode. I don't want to just display line numbers. I want to insert line numbers in a buffer, starting at point and going to mark, or perhaps continuing for some ...
1
vote
1answer
136 views

terminal fringes and diff-hl

I use diff-hl to highlight changed lines. However it doesn't play well in terminal mode. I know that terminal Emacs doesn't support fringes, and it is better to use diff-hl-margin-mode instead, it ...
1
vote
0answers
187 views

Global display line numbers mode not working

I can run (display-line-numbers-mode) and get line numbers but it doesn't work if I run (global-display-line-numbers-mode) (nothing happens). I have traced this to this function: (defun display-line-...
1
vote
1answer
64 views

Hook when line number changes

Is there a hook which runs when the cursor position changes its current line numbers? For a concrete toy problem, can i highlight the current line as yellow when the line number of the current cursor ...
1
vote
0answers
125 views

Show Git gutter after linenumbers

I am using emacs-nox and as some of you know there are always some problems if you want to display you line numbers while also using git-gutter. (Stuff like some extra margin jumping numbers etc.) ...
2
votes
2answers
2k views

Permanently display line numbers in emacs

I am asking this after having read this post: How do I display line numbers in emacs (not in the mode line)? I have tried using: M-x linum-mode and display-line-numbers-mode After closing emacs ...
15
votes
3answers
4k views

Show line number on error

Say that emacs throws some error that I don't understand. Or maybe the error says "Symbol's value as variable is void: modes", but there are many occurrences of the symbol modes in my code, so I need ...
3
votes
1answer
241 views

Emacs 26 line numbers are ugly in empty buffers

I like that Emacs 26's line numbers are fast, but they seem to have a problem. If you open an empty buffer, there is an empty area which is reserved for line numbers: Once you add some text onto that ...
0
votes
1answer
205 views

Unable to set relative line number as a default

I am trying to setup Emacs to have relative line numbering enabled by default via this plugin. According to the readme file Relative line numbering should already be enabled by default (by ...
1
vote
1answer
45 views

Number of lines the cursor is from the top of the screen when using hideshow.el

It's simple to find the number of lines from the cursor to top of the screen, eg: (- (line-number-at-pos (point)) (line-number-at-pos (window-start)))) However when the hideshow library is used to ...
0
votes
1answer
52 views

How can I get a list of all of the line numbers of headers / subtrees in an Org-mode file?

E.g., with this input: * Test A thing! ** Testing * Hello Get this output: (1 3 4)
3
votes
1answer
817 views

disable line numbers in helm buffers , emacs 26

I have emacs 26 installed and helm. I would like to disable line numbers in helm buffers ( and other buffers that has no use of line numbers) is there anyway to disable the native line number in ...
1
vote
3answers
550 views

How to have both fixed linum and relative linum?

I installed linum relative with this. But installing this replaced my fixed linum. I want to have both fixed line number and relative line number as well. How can I do this?
2
votes
0answers
2k views

Show both relative and absolute line numbers in Emacs 26

One of the new features in Emacs 26 is display-line-numbers-mode: Emacs now supports optional display of line numbers in the buffer. This is similar to what linum-mode provides, but much faster and ...
3
votes
0answers
263 views

Making relative line numbers behave well with folds?

Context: I have relative line numbers displayed in emacs. If there is a fold (for example: in org-mode), these relative numbers appear to "jump". For example if I'm on line 0 over a fold, emacs could ...
2
votes
1answer
147 views

Preserve original line numbering for a narrowed region

I noticed that whenever I narrow a region in emacs, the line numbering is relative to the narrowed region rather than being relative to the original file. Is there any way I can preserve the line ...
12
votes
1answer
341 views

How do I enable line numbers (on the left) every time when line is the long logical line

I have linum-mode enabled as well as truncate-lines. Works fine as long as Emacs displays column 0: The line number is showed on left (OK) But as soon as the window is scrolled horizontally, the ...
1
vote
1answer
717 views

How to turn on line numbering on modes that doesn't have by default?

I have spacemacs and when I edit a .py or .c file line numbering is turned on no problem, however when I open a .R file it isn't there (the mode is named ESS[S] to be precise). How can I turn it on ...
0
votes
1answer
157 views

How can I change the format of relative numbers?

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 To this
3
votes
1answer
2k views

Changing the background of line number column (linum) to the same color of line highlighting background color

Is there a way to set the background color of the line numbering to the same color of the line highlighting background color? So far I have to put the line numbering background color manually and of ...
0
votes
1answer
206 views

Eval-buffer works, init does not hl-line fix

I have written the following bit of emacs lisp that allows hl-line to extend past end of buffer to the rest of the line. Problem is, this only works if I use (eval-buffer) after start-up and not when ...
6
votes
1answer
280 views

Problem with line number limit in linum-mode

I am using the term of Emacs to compile some code, with linum-mode enabled to display the line numbers for the terminal, and the line numbers stop increasing as soon as they reach 2049. If I write ...
2
votes
1answer
168 views

How to get visual line-number-at-pos?

line-number-at-pos works fine when visual-line-mode is off. But I can't find its equivalent for visual-line-mode.
5
votes
1answer
886 views

Absolute line numbers on the current and relative line numbers on all other lines?

I know this plugin for relative numbers, which works fine (with the option (global-relative-line-numbers-mode). I also know this elisp code, which gives me perfectly working absolute numbers: (add-...
5
votes
2answers
237 views

Zero-indexed line numbering

I'm working with a file which is zero-indexed. Using M-x linum-mode, I can get emacs to display line numbers. How can I get emacs to start counting from 0 instead of 1?
1
vote
0answers
446 views

Right aligned relative numbering with separator space in Spacemacs using linum-relative

I've been using Vim for a while and now I've discovered Spacemacs and I found it great how it blends Vim ease of editing with Emacs superior power. I really loved some parts of my Vim config, one of ...
2
votes
0answers
423 views

Turning relative numbering on (with linum-relative) in Spacemacs only when in normal mode

In Vim I have relative numbering which is turned on most of the time but it's turned off when in insert mode or when the window losses focus (both when changing to another Vim window or when changing ...
4
votes
1answer
263 views

Why doesn't emacs store buffers internally as a tree (better random access, no line-number limitations)?

In section 11.18 of the GNU Emacs Manual, it's mentioned that buffers with a large number of lines line-number-display-limit or with particularly long lines line-number-display-limit-width might ...
2
votes
1answer
750 views

What's the name of this relative line number package?

The relative line number style in url below would be very useful for me. How can I replicate Vim's code folding? This package shows the number of current position, not just 0. Both sides of the ...
6
votes
1answer
82 views
3
votes
1answer
384 views

Setting width of relative-line-numbers

I am using the relative-line-numbers-mode and a 90 degree turned screen, which makes the text jump when it goes from displaying 100 in the relative number. Is it possible to set a fixed width for ...
19
votes
2answers
3k views

A faster method to obtain `line-number-at-pos` in large buffers

The function line-number-at-pos (when repeated about 50 times) is causing a noticeable slow-down in semi-large buffers -- e.g., 50,000 lines -- when point is near the end of the buffer. By slow-down, ...
5
votes
1answer
199 views

Confusion with line numbers

When I enable line numbers in Emacs the cursor starts in a line with no number in it. If you press enter then the numbers increment but always there is a line with no number. Why is that happening?