Vim: absolute numbering in any mode except `insert` mode
Check for existing issues
- [X] Completed
Describe the feature
I am using the following vim configuration that allows relative numbering in any mode except in insert mode:
set relativenumber # Relative line numbering
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
For now, Zed forces me to choose between relative line numbering or absolute line numbering.
I am not sure how this feature should be introduced. I see two possible approaches:
- add a new option
line_numbersthat takesabsolute,relativeandbothas values.bothcould be the behavior I described here. Unfortunately I didn't find a better name... - add a way to change settings using contexts (the same concept used by keymaps).
We could imagine something like:
However, this could introduce many issues. For example: should we accept any settings like theme, ...?{ "context": "vim_mode == insert", "settings": { "relative_line_numbers": false } }, { "context": "vim_mode != insert", "settings": { "relative_line_numbers": true } }
If applicable, add mockups / screenshots to help present your vision of the feature
No response
Can refer to the VSCode Vim plugin to add a setting for smart relative line numbers. https://github.com/VSCodeVim/Vim/issues/3020
I know I'm in the minority but I usually use both numbering in Neovim, absolute and relative side-by-side so an option for showing both would be awesome.
This is how Neovim does it:
I know I'm in the minority but I usually use both numbering in Neovim, absolute and relative side-by-side so an option for showing
bothwould be awesome.This is how Neovim does it:
Would love this, too. Don't know why this is already marked "closed".
@LittleFat3Tuan Sounds like a different feature request than the one described here. Could you please open a separate issue for it.
Has anything been done in this regard? Relative line numbers are a must locally, but when you're scrolled 200 lines away from your cursor (e.g. because you're trying to scroll to the line number from a stack trace), they are useless and actually counterproductive. Context-sensitive absolute line numbers would be awesome. Always side-by-side would be a trade-off although bloaty (but a setting can't harm I guess)