19

I'm wondering whether changing the space between lines is possible.

line spacing

How can I change "Line spacing"?

1 Answer 1

30

Didn't expect this to be possible, but there is actually an option for this. 'linespace':

'linespace' 'lsp'

Number of pixel lines inserted between characters. Useful if the font uses the full character cell height, making lines touch each other. When non-zero there is room for underlining. With some fonts there can be too much room between lines (to have space for ascents and descents). Then it makes sense to set 'linespace' to a negative value. This may cause display problems though!

It differs from your picture in that the option defines extra space added rather than distance between baselines, but should give you enough control anyway.

You need to add something like this to your .vimrc:

set linespace=3

For obvious reasons it will work only in gvim and not in terminal vim.

4
  • 1
    I added set linespace=3 But, nothing happened. line space is not changed. you said that "it will not work in terminal vim". thanks for your comment.
    – newbie16
    Oct 25, 2016 at 17:13
  • 1
    There's no way for Vim to control terminal behavior like that, but your terminal may allow you to change it. For example, both Terminal.app and iTerm2 in macOS allow you to change the line spacing in the font selector. Questions about how to do so in other terminals should be directed to the appropriate Stack Exchange site. Oct 26, 2016 at 13:10
  • "For obvious reasons it will work ... not in terminal vim." I think the most obvious implementation of this feature in vim would be to add 'linespace' blank lines between lines. Apr 29, 2019 at 14:08
  • 1
    I want to add that negative values will also work to decrease the space between lines; although this may cause display problems with some fonts or characters. Jan 21, 2022 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.