21

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

line spacing

How can I change "Line spacing"?

newbie16
  • 313
  • 1
  • 2
  • 5

2 Answers2

32

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.

xaizek
  • 1,788
  • 17
  • 17
  • 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 '16 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. – Jim Stewart Oct 26 '16 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. – lmat - Reinstate Monica Apr 29 '19 at 14:08
  • 2
    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. – Greg Barrett Jan 21 '22 at 19:15
1

Maybe the real question is how to increase terminal line hight?
On macOS I'm using iTerm2, in my case it was:
Preferences > Profiles > Text (tab): last attribute of the Font setting.

Michal S
  • 111
  • 2