17

In MacVim the text that I'm editing in all buffers is jammed up hard against the left hand side of the buffer. I find this quite visually jarring, especially if I'm looking at a vertical split.

It looks like there is only one pixel between my text and the window border.

Is there a setting that will allow me to add, say, a character width as a gutter or margin?

Scott
  • 17,127
  • 5
  • 53
  • 64
  • possible duplicate of [how to change the left margin in gvim](http://stackoverflow.com/questions/7893390/how-to-change-the-left-margin-in-gvim) – Randy Morris Oct 31 '11 at 01:12

3 Answers3

25

I use line numbering for that reason (:set number). But if you want a margin without the numbers, use:

:set foldcolumn=<width>

Example:

:set foldcolumn=3
MisterEd
  • 1,725
  • 1
  • 14
  • 15
  • 7
    Great stuff. Exactly what I needed! Because I've got a dark background, I also discovered how to set that as follows (in case somebody else finds this useful): `highlight FoldColumn guibg=gray14 guifg=white` – Scott Oct 29 '11 at 21:02
  • 2
    To add to Scott's comment: For Vim in a (black) terminal, one can use `:highlight FoldColumn ctermbg=0` to turn the foldcolumn black. – Søren Løvborg Oct 20 '15 at 22:44
  • 1
    This setting only support up to `9` columns. – Moberg Mar 11 '22 at 09:18
4

There's also a MacVim-specific option, MMTextInsetLeft, which can be set with defaults write org.vim.MacVim MMTextInsetLeft VALUE in a terminal (where VALUE is the number of pixels in the left margin. There are also settings for right, top, and bottom margin, see help macvim-user-defaults for details.

1

It's easy:

 set foldcolumn=2
 highlight FoldColumn ctermbg=0
 highlight FoldColumn ctermfg=0
Farshid Ashouri
  • 16,143
  • 7
  • 52
  • 66