anuvyklack / pretty-fold.nvim

Foldtext customization in Neovim
Apache License 2.0
441 stars 22 forks source link

Getting an error when pressing `h` on a fold #5

Closed farzadmf closed 2 years ago

farzadmf commented 2 years ago

Hi, I installed the plugin using vim-plug, and I added the setup lines in my config:

require('pretty-fold').setup{}
require('pretty-fold.preview').setup_keybinding()

However, when I go on a fold and press h, I get the following error:

E5108: Error executing lua ...vim/plugged/pretty-fold.nvim/lua/pretty-fold/preview.lua:112: Vim(autocmd):E216: No such group or event:
ModeChanged <buffer> ++once lua _G.pretty_fold_preview[1].close()
stack traceback:
        [C]: in function 'cmd'
        ...vim/plugged/pretty-fold.nvim/lua/pretty-fold/preview.lua:112: in function 'show_preview'
        ...vim/plugged/pretty-fold.nvim/lua/pretty-fold/preview.lua:127: in function 'keymap_open_close'
        [string ":lua"]:1: in main chunk

I'm using neovim version 0.6.1

smallpondtom commented 2 years ago

@farzadmf I am having the exact same issue. I temporarily commented out the part giving the error which did stop the error message. Which is in the preview.lua file.

-- au CursorMoved,BufLeave,ModeChanged <buffer> ++once lua _G.pretty_fold_preview[%d].close()

 -- CursorHold
 vim.cmd(string.format([[
    augroup fold_preview
       au!
       au WinScrolled <buffer> lua _G.pretty_fold_preview[%d].scroll()
       au VimResized  <buffer> lua _G.pretty_fold_preview[%d].resize()
    augroup END
    ]], curbufnr, curbufnr, curbufnr
 ))
farzadmf commented 2 years ago

I temporarily commented out the part giving the error

Seems like a hack? :stuck_out_tongue_closed_eyes:

anuvyklack commented 2 years ago

This is because Neovim 0.6.1, surprisingly for me, doesn't have "ModeChanged" event.