pseewald / vim-anyfold

Language agnostic vim plugin for folding and motion based on indentation.
MIT License
268 stars 11 forks source link

GitGutter Preview throws error in neovim when vim-anyfold is used #34

Open vinay0410 opened 4 years ago

vinay0410 commented 4 years ago

I am using vim-anyfold with GitGutter plugin. :GitGutterPreviewHunk opens a pop window to view changes. But when autocmd Filetype * AnyFoldActivate is present in my vimrc, it throws the following error:

Error detected while processing function gitgutter#hunk#preview[3]..<SNR>153_hunk_op[62]..<SNR>153_preview[6]..<SNR>153_populate_hunk_preview_window:
line   14:
E16: Invalid range:       call nvim_win_set_height(s:winid, height)
line   18:
E16: Invalid range:       call nvim_buf_set_lines(winbufnr(s:winid), 0, -1, v:false, [])
line   19:
E16: Invalid range:       call nvim_buf_set_lines(winbufnr(s:winid), 0, -1, v:false, a:body)
line   20:
E16: Invalid range:       call nvim_buf_set_option(winbufnr(s:winid), 'modified', v:false)
line   23:
E16: Invalid range:       call nvim_buf_clear_namespace(winbufnr(s:winid), ns_id, 0, -1)
Error detected while processing function gitgutter#hunk#preview[3]..<SNR>153_hunk_op[62]..<SNR>153_preview[6]..<SNR>153_populate_hunk_preview_window[24]..gitgutter#diff_highlight#process:
line   21:
E16: Invalid range:     call s:diff(rline, aline, i, i+removed, 0, 0, regions, 1)
Error detected while processing function gitgutter#hunk#preview[3]..<SNR>153_hunk_op[62]..<SNR>153_preview[6]..<SNR>153_populate_hunk_preview_window:
line   29:
E16: Invalid range:       call nvim_win_set_cursor(s:winid, [1,0])
Error detected while processing function gitgutter#hunk#preview[3]..<SNR>153_hunk_op[62]..<SNR>153_preview:
line    7:
E16: Invalid range:   call s:enable_staging_from_hunk_preview_window()

I understand that this is also related to GitGutter, but I just wanted to confirm if vim-anyfold does anything which might cause issue when opening pop-up windos in neovim v0.4.4

pseewald commented 4 years ago

It is known that autocmd Filetype * AnyFoldActivate may conflict with buffers managed by other plugins and should not be used. Instead, activate anyfold for specific filetypes only. I leave this issue open to remind myself that I should document this in the readme.