Yggdroot / indentLine

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

disable indent line when viewing diff #289

Closed pirey closed 4 years ago

pirey commented 4 years ago

2020-02-11-150534_1366x768_scrot

as shown in the picture, the indent line highlighting doesn't match highlight for diff line, is it possible to get the same highlight for diff lines? or can i somehow disable the indent line when i'm opening a diff?

i'm using fugitive-vim :Gdiffsplit feature for the diff

kazhala commented 4 years ago

I did something like this to disable indent-lines in diff mode, works with fugitive Gdiffsplit autocmd OptionSet diff IndentLinesDisable

Screen Shot 2020-02-15 at 6 57 32 pm
pirey commented 4 years ago

hi @kazhala , i tried your solution and it only work when i open a diff, the problem is when i close the diff, indentLine is still disabled

do you know any autocmd event or option to revert it?

pirey commented 4 years ago

based on your suggestion, i tried something like this

augroup custom_indentLine
    autocmd!
    autocmd OptionSet diff call ToggleIndentLine()
augroup END

function! ToggleIndentLine()
    if &diff
        execute 'IndentLinesDisable'
    else
        execute 'IndentLinesEnable'
    endif
endfunction

the indent line is disabled when i open a diff, but when i close diff window, the indent line still disabled.

i have confirmed that the &diff option changed back to 0, but it seems neovim doesn't detect when the &diff option set back to 0

kazhala commented 4 years ago

do you know any autocmd event or option to revert it?

Sadly no, I remember I was facing the issue as well not being able to set it back.

Yggdroot commented 4 years ago

Fixed.

pirey commented 4 years ago

2020-03-02-175716_1366x768_scrot it works, thanks

koallen commented 4 years ago

This is breaking my NERDTree startup on VimEnter because the cursor now stays on the empty buffer instead of the NERDTree window.

Yggdroot commented 4 years ago

@koallen Fixed.