https://github.com/mluders/comfy-line-numbers.nvim
A Neovim plugin that makes vertical motions more comfortable
https://github.com/mluders/comfy-line-numbers.nvim
Last synced: 8 days ago
JSON representation
A Neovim plugin that makes vertical motions more comfortable
- Host: GitHub
- URL: https://github.com/mluders/comfy-line-numbers.nvim
- Owner: mluders
- License: mit
- Created: 2024-06-21T18:34:28.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-17T07:01:46.000Z (about 1 month ago)
- Last Synced: 2025-03-17T08:25:14.857Z (about 1 month ago)
- Language: Lua
- Homepage:
- Size: 24.4 KB
- Stars: 25
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim-sorted - mluders/comfy-line-numbers.nvim
README
# Comfy Line Numbers
A Neovim plugin that makes vertical motions more comfortable.

## The problem
I love using relative line numbers for vertical movement. But I've noticed a problem...
* `6j`
* `19k`
* `18j`What do these motions have in common? The right-hand fingers are overloaded, having to jump between numbers and letters.
It's too much movement.
## The solution
Represent line numbers using left-hand digits:
1\
2\
3\
4\
5\
11\
12\
13\
14\
15\
21\
22\
...\
55This lets your left hand focus on digits, while your right hand focuses on `j` and `k`.
Less movement. More comfort.
## How it works
1. Relative line numbers are displayed in status column (with right-hand digits omitted).
2. Vertical motions are re-mapped to their original meanings:
* `11j` becomes `6j`
* `34k` becomes `19k`
* `33j` becomes `18j`
* etc.## Installation
Using your plugin manager of choice (lazy.nvim in the example below):
```lua
return {
'mluders/comfy-line-numbers.nvim'
}
```## Customization
```lua
require('comfy-line-numbers').setup({
labels = {
'1', '2', '3', '4', '5', '11', '12', '13', '14', '15', '21', '22', '23',
'24', '25', '31', '32', '33', '34', '35', '41', '42', '43', '44', '45',
'51', '52', '53', '54', '55', '111', '112', '113', '114', '115', '121',
'122', '123', '124', '125', '131', '132', '133', '134', '135', '141',
'142', '143', '144', '145', '151', '152', '153', '154', '155', '211',
'212', '213', '214', '215', '221', '222', '223', '224', '225', '231',
'232', '233', '234', '235', '241', '242', '243', '244', '245', '251',
'252', '253', '254', '255',
},
up_key = 'j'
down_key = 'k'-- Line numbers will be completely hidden for the following file/buffer types
hidden_file_types = { 'undotree' },
hidden_buffer_types = { 'terminal' }
})
```## Testing
The specs use [plenary.nvim tests](https://github.com/nvim-lua/plenary.nvim/blob/master/TESTS_README.md).
To run the spec in the current buffer:
```vim
:PlenaryBustedFile %
```
To run all of the specs:
```vim
:PlenaryBustedDirectory tests
```
Note: The tests run in a remote nvim instance and display output in a new window in terminal mode.
You may need to C-\ C-n to switch back to NORMAL mode and close the window.Optionally, you can run the tests from the command line. Here is an ex command that opens a new terminal
in a split window and runs all the tests:
```vim
:split term://nvim --headless -c 'PlenaryBustedDirectory tests'
```