Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make sign use only one character width?

Tags:

vim

Sign is referring to the extra column on the left that is added when using e.g. the syntastic plugin. I'd like to save on space by having it take up only one column of space, if possible. I can change the sign used to > from >> but it's still two char's wide!

like image 684
Steven Lu Avatar asked Jun 12 '13 03:06

Steven Lu


2 Answers

Unfortunately there is no way to modify the width of the sign column. It's hard-coded in Vim at two characters wide.

It's defined in the Vim source in screen.c (line 2149 in vim-73):

# ifdef FEAT_SIGNS
  if (draw_signcolumn(wp))
  {
      int nn = n + 2;

      /* draw the sign column left of the fold column */
      if (nn > W_WIDTH(wp))
          nn = W_WIDTH(wp);
      screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
                  W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n,
                  ' ', ' ', hl_attr(HLF_SC));
      n = nn;
  }
# endif

The int nn = n + 2 line is the culprit. You could try to hack it in the source, but I don't know if the rest of the layout depends on a width of 2. Note that this is for the non-GUI implementation; the GUI width is also fixed, but defined elsewhere in the source.

like image 91
Jim Stewart Avatar answered Nov 19 '22 09:11

Jim Stewart


A workaround that works for anyone using set number.

set signcolumn=number will draw signs over the number column:

enter image description here

like image 2
Kache Avatar answered Nov 19 '22 10:11

Kache