feat(config): add custom keys to spelling module #999
+14
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The spelling module is great. I previously raised #954 because I wanted to use it more widely. (anyone coming from that issue see solution below). I now use it regularly in daily workflows.
However I find it is much quicker to use home-row and other alpha keys to make selections than numbers. Currently the keys are hard coded as a local string. I propose to make those user configurable.
Related Issue(s)
#954 is not really related but for anyone coming from there the solution I found was to call
require('which-key').show('z=')
. See example config below:Solution
Simple addition of a new variable within
opts.plugins.spelling
to allow user customisation of the keys used.I have also added a simple validation to ensure the number of keys exceeds the number of suggestions. Docs updated to match new config.
Challenges/Questions
Currently that validation is within spelling.setup(). I call
Util.warn()
in the same way theconfig.validate()
does. However, you may prefer this validation to sit withinconfig.validate
. I thought probably better to only call it when the spelling plug-in is enabled.Summary
This is a fairly small PR and hopefully does not add complexity to the overall module. Happy for feedback and to make minor changes are required. Thanks for creating this (and other!) great tools.
Example config