Yggdroot / indentLine

A vim plugin to display the indention levels with thin vertical lines
MIT License
4.14k stars 230 forks source link

Tabs and indent lines not matching Conceal highlight group #244

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello, I have set up MacVim with this plugin (mvim 8.1 from homebrew, has("Conceal") returns 1). It works well, however, the Conceal highlight group doesn't seem to apply to the indent lines or tabs, as shown:

Example

(Note the difference in highlight between the indentation and both Normal and Conceal)

The relevant section of my .vimrc are as follows:

set tabstop=4
set softtabstop=0 noexpandtab 
set shiftwidth=4
set conceallevel=1
let g:indentLine_conceallevel=1
set list lcs=tab:\|\ 
let g:indentLine_setColors = 0
let g:indentLine_bgcolor_gui = '#2B2B2B'
let g:indentLine_char = '|'

I would like to know if there is a problem with the way I have set up the plugin, or what highlight group is being used for the indentation so I can change it.

Thanks in advance.

Yggdroot commented 6 years ago

I think you are using tab to indent the code. IndentLine only supports using space.

ghost commented 6 years ago

The solution from #111 seems to work well enough in supporting tabs (set list lcs=tab:\|\ in .vimrc). However, setting my .vimrc to use spaces and converting the file only results in the indent lines no longer appearing. (Somewhat related: :IndentLinesToggle fails, claiming it is "Not an editor command")

Updated section of .vimrc:

set shiftwidth=4
set tabstop=4
set conceallevel=1
let g:indentLine_conceallevel=1
let g:indentLine_setColors = 0
let g:indentLine_bgcolor_gui = '#2B2B2B'
let g:indentLine_char = '|'
Yggdroot commented 6 years ago

Can not reproduce.

ghost commented 6 years ago

It's likely a problem with my attempt at installing the plugin. (I'm still very new to vim) Is it enough to have after/plugin/indentLine.vim in ~/.vim?

ghost commented 6 years ago

To answer my own question: No it is not. Plugin has been moved to ~/.vim/plugin/indentLines.vim and shows up when :script has been run. Commands now succeed, yet still no visible outcome. No changes have been made to ~/.vimrc

Yggdroot commented 6 years ago

Please refer to https://github.com/Yggdroot/indentLine/issues/59.

ghost commented 6 years ago

Having read through #59, these are my updated relevant lines in .vimrc:

set tabstop=4
set shiftwidth=4
let g:indentLine_setColors = 0
let g:indentLine_char = '|'
set conceallevel=1
let g:indentLine_conceallevel=1
autocmd VimEnter,WinEnter,BufNewFile,BufRead,BufEnter,TabEnter * IndentLinesReset
syntax enable

However, the only time I have been able to see indentation lines are using tabs, where they were the wrong colour. (set list lcs=tab:\|\ causes the indents to appear)

Yggdroot commented 6 years ago

Can you make sure that every character in your code is not tab? I think you even don't know the difference between tab and space.

ghost commented 6 years ago

I've found the solution, sorry for being annoying.

My .vimrc was set to

set tabstop=4
set shiftwidth=4

which caused the tab to not correspond to spaces, and what I should have used was

set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab

Thank you for your help