anuvyklack / pretty-fold.nvim

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

Preview key mappings #20

Closed wookayin closed 2 years ago

wookayin commented 2 years ago

Hi! Thanks for a great plugin.

I've run into some issues with preview key mappings.

First, keymap cannot be disabled by setting key = nil, as it will be superseded by a default config. Even if I have the following config, it will result in the default h key being mapped to opening preview.

require('pretty-fold.preview').setup {
  key = nil,
}

In addition, the mapping key can be either h or l, but not both. I wanted to map both keys. The config could be improved by allowing two mapping keys (or any other keys in general):

require('pretty-fold.preview').setup {
  key = {'h', 'l'},
}
wookayin commented 2 years ago

Looking at the code,

require('pretty-fold.preview').setup {
  key = false,
}

would be the right way to disable the default key mappings (documentation could be improved).

anuvyklack commented 2 years ago

I have recently change the keybindings mechanism. Now it is possible to map any keys your want.

wookayin commented 2 years ago

From v3.0, disabling the default keybindings now should be

require('pretty-fold.preview').setup {
  default_keybindings = false,
}
alxndr commented 2 years ago

I have added the default_keybindings = false config, however I still see this warning message every time I open neovim:

[pretty-fold.nvim] the "anuvyklack/nvim-keymap-amend" plugin is required for key mappings to working

...is there a way to turn that off?

anuvyklack commented 2 years ago

Fixed.