Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative Line Numbers #5958

Closed
1 task done
nayaabkhan opened this issue Feb 25, 2023 · 29 comments
Closed
1 task done

Relative Line Numbers #5958

nayaabkhan opened this issue Feb 25, 2023 · 29 comments
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] vim

Comments

@nayaabkhan
Copy link

Check for existing issues

  • Completed

Describe the feature

Show the line number relative to the current line (where the cursor is). It is usually helpful in combination with Vim mode, to jump to a specific line using motion keys (e.g., h-j-k-l).

Vim has it built-in (https://vimhelp.org/options.txt.html#%27relativenumber%27). Visual Studio Code also has it built-in using editor.lineNumbers.

If applicable, add mockups / screenshots to help present your vision of the feature

@nayaabkhan nayaabkhan added enhancement [core label] triage Maintainer needs to classify the issue labels Feb 25, 2023
@JosephTLyons JosephTLyons added editor Feedback for code editing, formatting, editor iterations, etc and removed triage Maintainer needs to classify the issue labels Feb 26, 2023
@jschuur
Copy link

jschuur commented Mar 16, 2023

This was the first thing I looked for after installing Zed an enabling vim_mode.

@ruiconti
Copy link

+1 this is key to fast code navigation.

@WindSoilder
Copy link
Contributor

It'd be really useful in vim mode

@0x2CA
Copy link
Contributor

0x2CA commented May 6, 2023

Is it possible to display both

@dsosby
Copy link

dsosby commented Jun 4, 2023

Vim mode without relative line numbers is like pizza without cheese.

ConradIrwin referenced this issue Aug 25, 2023
- Add relative_line_mode
- vim change for wrapped lines

Release Notes:

- Add a `relative_line_numbers` setting
([#988](https://github.com/zed-industries/community/issues/998)).
@JosephTLyons
Copy link
Collaborator

JosephTLyons commented Aug 25, 2023

This feature has been merged into main and should be available in v0.102.0.

https://twitter.com/zeddotdev/status/1695159901411070150?s=20

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@DeVoresyah
Copy link

already try to set it as true but doesn't work

image

@cyr-l
Copy link

cyr-l commented Feb 27, 2024

@DeVoresyah "relative_line_numbers": trueworks for me (not under features though but at the root of the object).

@DeVoresyah
Copy link

@DeVoresyah "relative_line_numbers": trueworks for me (not under features though but at the root of the object).

already put on line 15. I even restart my zed editor

@DeVoresyah
Copy link

nevermind, it works after I put on ~/.config/zed/settings.json

@auspy
Copy link

auspy commented Apr 12, 2024

is there any option that tells the current line if the relative line numbers is true. i would like to know current line along with relative line numbers

@gaardhus
Copy link

gaardhus commented May 7, 2024

is there any option that tells the current line if the relative line numbers is true. i would like to know current line along with relative line numbers

@auspy that seems to be the default at least as of now?

@alexthe2
Copy link

Is there an option to make this togglable? In VS (though heavily plugin-ned) I have CMD+L cycle from usual to vim and vice-versa. Very useful when debugging C with stackframes

@lamhungypl
Copy link

Is there an option to make this togglable? In VS (though heavily plugin-ned) I have CMD+L cycle from usual to vim and vice-versa. Very useful when debugging C with stackframes

you can toggle it via command now

image

@ligmaSec
Copy link

ligmaSec commented Jul 2, 2024

is there any way to turn off relative numbering when in insert mode and toggling it back on when in normal mode ?

@TimWolfram
Copy link

TimWolfram commented Jul 16, 2024

is there any way to turn off relative numbering when in insert mode and toggling it back on when in normal mode ?

This is exactly what I'm looking for as well, it adds another visual indicator of the mode you are in which is nice.

@diogox
Copy link

diogox commented Aug 19, 2024

is there any way to turn off relative numbering when in insert mode and toggling it back on when in normal mode ?

+1 for this.

In NORMAL mode I want to move relative to the current line.
In INSERT mode I want to see all line numbers to quickly refer to colleagues.

@jacobzim-stl
Copy link

I believe the use case of relative line numbers in insert mode only is mentioned in the documentation, but it doesn't seem to do anything.

@diogox
Copy link

diogox commented Aug 29, 2024

@jacobzim-stl it's in the alpha version for now. Will be in the next release most likely.

@luis-rodas
Copy link

Yep!! It's not working yet

@AlbertMarashi
Copy link
Contributor

@jacobzim-stl it's in the alpha version for now. Will be in the next release most likely.

Great to hear, was going to say it's not working for me either

@AlbertMarashi
Copy link
Contributor

image
Hmm actually, supposedly this was released last year, so why do these options not appear?

@dnjohnson
Copy link

dnjohnson commented Sep 4, 2024

Hmm actually, supposedly this was released last year, so why do these options not appear?

The option is at the root level, not nested under vim.

Screenshot 2024-09-04 at 11 25 51 AM

@jacobzim-stl
Copy link

jacobzim-stl commented Sep 4, 2024

@dnjohnson Yes, we were only talking about the "toggle relative line numbers" feature. See the docs link in my first comment

@dnjohnson
Copy link

@dnjohnson Yes, we were only talking about the "toggle relative line numbers" feature. See the docs link in my first comment

Yeah I'm going to level with you, I didn't read through the full thread. Saw the first comment and the last comment and inferred the rest. That's on me.

@AlbertMarashi
Copy link
Contributor

Hmm actually, supposedly this was released last year, so why do these options not appear?

The option is at the root level, not nested under vim.

Hmm, well it would be nice to have an option/feature where language settings can be configured differently from vim mode.

@jacobzim-stl
Copy link

jacobzim-stl commented Sep 9, 2024

Mine was fixed today, thanks team!

@erfannariman
Copy link

Mine was fixed today, thanks team!

Just to be sure, toggle_relative_line_numbers actually works for you now? If so, where did you put it in the settings.json?

@erfannariman
Copy link

erfannariman commented Dec 30, 2024

Mine was fixed today, thanks team!

Just to be sure, toggle_relative_line_numbers actually works for you now? If so, where did you put it in the settings.json?

To answer my own question, it's under the vim setting, here's a snippet of my settings:

  "vim_mode": true,
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "relative_line_numbers": true,
  "vim": {
    "toggle_relative_line_numbers": true
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] vim
Projects
None yet
Development

No branches or pull requests