I have gvim 7.3 on XP.
My problem is that when I edit a file and have line numbers turned off, the text is too close to the left window margin. I don't want to add leading white space, I want to increase the margin. When I have line numbers on (which I don't like), there is sufficient space between the left window border and the line number, and sufficient space between the line number and the text. But there is no left margin when line numbers are turned off.
I would like to increase this margin, but don't know how it is addressed.

- 101
- 1
- 3
-
By "text is too close to the left window margin" you mean, you don't see some of it or ...? It is not "closer" than in any other editor, AFAIK. – Rook Oct 25 '11 at 19:25
6 Answers
I never had any problems with the text being too close to the left window margin, but if you prefer text more in the screen middle (horizontal-wise) you might be interested in VimRoom. It is a distraction free plugin, but feel free to throw out the parts you don't like.
So instead of this
you get this
-
It seems https://project.mikewest.org/ is no longer a maintained site, but that the plugin can be found at https://github.com/mikewest/vimroom. The site owner links to his GitHub page from his [bio](https://mikewest.org/is). – sampi Jul 01 '18 at 06:40
You can exploit foldcolumn
if you aren't using folds for the current document. It will stop you from setting this to a value higher than 12 though so if you want a wider margin than that you're pretty much out of luck as far as I know.
Alternatively you can turn on line numbers and change the LineNr
highlight group to have the text be the same color as the background color, effectively hiding the line numbers while letting you set numberwidth
to your desired margin (up to 10 I believe).

- 39,631
- 8
- 69
- 76
In case anyone wants to increase the left margin in Vim, you can do:
:set foldcolumn=12
:hi FoldColumns ctermbg=none
Or:
Changing the number colors to hide them won't work.
:set nuw=8

- 47,830
- 31
- 106
- 135
OK, here is solution 2:
foldcolumn
does the trick (foldcolumn is the column left from the linenumbers).
In (vim) exec mode :set foldcolumn=12
or in the vim.rc foldcolumn=12
If you want to change the color too hi FoldColumn guibg=#003f3f
(or ctermbg=#...... instead of guibg).

- 63
- 4
-
Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Sep 10 '21 at 14:03
I think "left" would help:
:[range]le[ft] [indent]
Left-align lines in [range]. Sets the indent in the
lines to [indent] (default 0).
So if you use
:%le5
you have the margin you need for the complete document.
lem

- 1