10

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.

user675368
  • 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 Answers6

10

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

enter image description here

you get this

enter image description here

Zoe
  • 27,060
  • 21
  • 118
  • 148
Rook
  • 60,248
  • 49
  • 165
  • 242
  • 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
8

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).

Randy Morris
  • 39,631
  • 8
  • 69
  • 76
4

In case anyone wants to increase the left margin in Vim, you can do:

http://imgur.com/xBlpu6X

:set foldcolumn=12
:hi FoldColumns ctermbg=none

Or:

http://imgur.com/ErpCnM9

Changing the number colors to hide them won't work.

:set nuw=8
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
3

check out Goyo, it works for me.

when editing markdown, turn on goyo:

au FileType markdown Goyo
timfeirg
  • 1,426
  • 18
  • 37
1

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).

this is foldcolumn

Michael
  • 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
-3

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

lem
  • 1