So I'm using Vim's line numbering with

set number
set numberwidth=4

But I find that if line numbers exceed 999, then the gutter is automatically expanded to accommodate them. I actually don't want this--I use vim within tmux and need to preserve pane size as well as the number of columns in the editor. I would rather have the most significant digit(s) cropped, so that line 1234 appears as 234, for example. Is there any way to achieve this?

  • 1
    I don't think this is possible without a custom scripted solution (and even that I'm not 100% sure about). There's a setting for the minimum width but not the maximum. As far as a partial solution, it's hard to imagine Vim having a builtin setting that allows something ugly like truncating the numbers.
    – B Layer
    Commented Dec 2, 2020 at 16:41
  • 1
    This is not possible Commented Dec 3, 2020 at 8:41
  • please paste picture here, so the problem will become more directly.
    – user32495
    Commented Dec 5, 2020 at 8:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.