Error when calling GitGutterPreviewHunk (after AnyFoldActivate was called)
Andrew15-5 opened this issue · 0 comments
What is the latest commit SHA in your installed vim-gitgutter?
988a6db
What vim/nvim version are you on?
Neovim v0.7.0-dev
Hi, I was having this issue for a long time until now and I don't know how to do it properly, so I opened this issue just to help someone out there who might have the exact same problem as me.
Problem
So the problem is this (after writing GitGutterPreviewHunk command in command mode):
After that, current buffer looks like this (empty buffer "hunk-preview" with black rectangle at the bottom):
and other buffers work fine, but if I close "hunk-preview" buffer it kills Neovim instance and messes up bash (to fix it I need to run reset
command).
The cause of the problem
And here's what I found:
In init.vim
there was a line that looks like this (probably copied from a place that other people could've copied too):
autocmd FileType *\(^vim\)\@<! AnyFoldActivate
And when it's removed, the error is gone! Basically when calling GitGutterPreviewHunk a new buffer (at least 1) is being created and by modifying last line like this:
autocmd FileType * echo &ft
I found out that the file type of this mysterious (at least for me) buffer is diff
.
Solution
Therefore, the solution is to change the line to something like this (don't really understand what that regex does exactly, but probably excluding vim
file type):
let anyfold_filetype_blacklist = ['vim', 'diff']
autocmd FileType * if index(anyfold_filetype_blacklist, &ft) < 0 | AnyFoldActivate