Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I increase the spacing of the line number margin in vim?

Tags:

vim

margin

macvim

I have a problem with my colorscheme in vim:

alt text
(source: tinygrab.com)

The line numbers are too close to the code. How I can increase the width of the line numbers' right margin?

like image 869
Sasha Koss Avatar asked Mar 28 '10 04:03

Sasha Koss


People also ask

How do I change line numbers in vim?

Press ESC key. At the : prompt type the following command to run on line numbers: set number. To turn off line numbering, type the following command at the : prompt set nonumber.


1 Answers

This bothered me, too; I hate having text crammed up against a block of solid color. It makes me claustrophobic.

Here's what I did as a workaround (in MacVim, but I expect the same technique will work elsewhere):

In your preferred colorscheme, set the background color of the line-number column to be the same as the background color for normal text, and the line-number foreground color to something low-contrast and unobtrusive (so it doesn't look like it's part of your normal text). I use white-on-black for normal text, and dark-grey-on-black for the line numbers:

hi LineNr  guifg=#505050   guibg=Black hi Normal  guifg=White     guibg=Black 

Admittedly, this doesn't fix the problem so much as hide it, but it's worked well for me.

like image 195
Bill Odom Avatar answered Sep 21 '22 03:09

Bill Odom