24

I get a grey bar on left side in vim for one file. This does not happen for any other file. What is this? And how to get rid of it?

EDIT:

This is what it looks like: This goes on for the full height of the file. It does not appear in any other files. The file is a *.C which is correctly identified as of cpp file type but this thing does not happen to other files where they are being identified as cpp. colourscheme is default

alt text

EDIT2: Here is the view file for the file:

let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
argglobal
setlocal keymap=
setlocal noarabic
setlocal autoindent
setlocal nobinary
setlocal bufhidden=
setlocal buflisted
setlocal buftype=
setlocal cindent
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
setlocal cinoptions=
setlocal cinwords=if,else,while,do,for,switch
setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
setlocal commentstring=/*%s*/
setlocal complete=.,w,b,u,t,i
setlocal completefunc=
setlocal nocopyindent
setlocal nocursorcolumn
setlocal nocursorline
setlocal define=
setlocal dictionary=
setlocal diff
setlocal equalprg=
setlocal errorformat=
setlocal expandtab
if &filetype != 'cpp'
setlocal filetype=cpp
endif
setlocal foldcolumn=2
setlocal foldenable
setlocal foldexpr=0
setlocal foldignore=#
setlocal foldlevel=0
setlocal foldmarker={{{,}}}
setlocal foldmethod=diff
setlocal foldminlines=1
setlocal foldnestmax=20
setlocal foldtext=foldtext()
setlocal formatexpr=
setlocal formatoptions=tcq
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
setlocal grepprg=
setlocal iminsert=0
setlocal imsearch=0
setlocal include=
setlocal includeexpr=
setlocal indentexpr=
setlocal indentkeys=0{,0},:,0#,!^F,o,O,e
setlocal noinfercase
setlocal iskeyword=@,48-57,_,192-255
setlocal keywordprg=
setlocal nolinebreak
setlocal nolisp
setlocal nolist
setlocal makeprg=
setlocal matchpairs=(:),{:},[:]
setlocal nomodeline
setlocal modifiable
setlocal nrformats=octal,hex
setlocal nonumber
setlocal numberwidth=4
setlocal omnifunc=
setlocal path=
setlocal nopreserveindent
setlocal nopreviewwindow
setlocal quoteescape=\\
setlocal noreadonly
setlocal norightleft
setlocal rightleftcmd=search
setlocal scrollbind
setlocal shiftwidth=4
setlocal noshortname
setlocal smartindent
setlocal softtabstop=0
setlocal nospell
setlocal spellcapcheck=[.?!]\\_[\\])'\"\    \ ]\\+
setlocal spellfile=
setlocal spelllang=en
setlocal statusline=
setlocal suffixesadd=
setlocal swapfile
setlocal synmaxcol=3000
if &syntax != 'cpp'
setlocal syntax=cpp
endif
setlocal tabstop=4
setlocal tags=
setlocal textwidth=0
setlocal thesaurus=
setlocal nowinfixheight
setlocal nowinfixwidth
setlocal nowrap
setlocal wrapmargin=0
let s:l = 75 - ((20 * winheight(0) + 29) / 59)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
75
normal! 0
let &so = s:so_save | let &siso = s:siso_save
doautoall SessionLoadPost
" vim: set ft=vim 
nakiya
  • 14,063
  • 21
  • 79
  • 118
  • The bar might be a [foldcolumn](http://vimdoc.sourceforge.net/htmldoc/fold.html#fold-foldcolumn)? It's hard to say based on color, since everyone has their own colorschemes. – Cascabel Nov 06 '10 at 06:15
  • can you put your vim cursor over the bar? – wilhelmtell Nov 06 '10 at 07:52
  • If you're still into vim here's a good book http://amzn.to/Uoz2Nd that answers many of the configuration questions – afarazit Dec 13 '12 at 23:19

6 Answers6

24

:set foldcolumn=0

Marko Kevac
  • 2,902
  • 30
  • 47
  • 1
    nakiya: Fold column indicates open and closed folds in the buffer. See `:help folding` for more details. – ib. Nov 06 '10 at 11:15
  • 1
    @nakiya I get the bar after running `diffsplit`. `help diff` says that `foldcolumn` defaults to 2 for diff mode. `diffoff!` resets the options that `diff` set. There are probably other commands that set `foldcolumn`. – Kelvin Jun 20 '13 at 19:43
24

In my case, no others but below was the solution.

set signcolumn=no
Lyle
  • 1,238
  • 14
  • 16
9

It looks like some plugin creates a sign. Try doing

sign unplace *

To find where this plugin is located, try

vim /path/to/file/that/causes/problem -c 'redir! >/tmp/scriptnames' -c scriptnames -c 'redir END' -c 'qa!'
perl -p -i -e 's/^\s*$//g;s/^\s*\d+:\s//g' /tmp/scriptnames
grep -F -w 'sign define' `cat /tmp/scriptnames`
ZyX
  • 52,536
  • 7
  • 114
  • 135
  • @ZyX Could you provide a little more insight into what this command actually does or direct us to documentation? – Choylton B. Higginbottom Sep 16 '15 at 16:05
  • 1
    @meetalexjohnson Which command? First is described in `:h :sign` and simply unplaces all signs (note about signs: defining sign creates a structure with some metadata, but does not actually cause Vim to display anything. Placing sign creates a connection between a sign and a pair `(buffer, line number)` and makes Vim display the sign when buffer is displayed). Block with three commands (1) captures the output of `:scriptnames` (`:h :scriptnames`) to a file, (2) uses perl to leave only file names and (3) checks whether any of the sourced files contains `sign define`. – ZyX Sep 16 '15 at 20:06
  • This proved to be the case for me: when I made a change to a C file and saved it it would show up. I did `:help sign` and I saw something that looked familiar (and when I undid the change and save again it went away). Then I tried `:sign list` and found the problem: I was playing with Syntastic the other day and it was this, it seems, that's the problem. Edit: Yes that was it. Thanks for the pointer to the right direction! – Pryftan Feb 28 '20 at 17:15
1

Just to add you can tell which script set the option by using

:verbose set foldcolumn?

You can replace foldcolumn with any name that you are interested.

chenyu
  • 11
  • 1
  • 2
1

There can be a few reasons for this. One may be a modeline. Modeline is a special line at the beginning or end of a file that sets specific settings for Vim for that file. Look for a comment line (or a line that starts with a blank), followed by the word vim and a space. Any text following that in the line may be of interest in debugging this.

Another option may be that the file has a specific filetype that triggers an autocommand set in your .vimrc file or one of its sourced modules. In particular look for set number, relativenumber, colorcolumn, foldcolumn or maybe even specific highlight settings for blanks. In Vim within the relevant buffer enter :set ft? followed by a carriage-return to know the filetype set for that file; use this to look at the settings for that filetype in your vimrc or the highlight settings in your .vim directory tree.

wilhelmtell
  • 57,473
  • 20
  • 96
  • 131
0

The most likely cause for this is something being in a modeline - a line with contents like "vi:" or "vim:" or "ex:" in it, and something is then after it which is being interpreted as an option. See :help modeline for more information. I can't think off the top of my head what options could make it look like that.

Try doing :set nomodeline and reload the file - if that fixes it, the file has a modeline (whether you intended it to have or not). Then you can see about fixing it, or disabling modeline support if you wish in your vimrc.

Chris Morgan
  • 86,207
  • 24
  • 208
  • 215