Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(main): adds configuration option to set the spelling plugin's trigger #910

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ local defaults = {
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
trigger = "z=", -- Key combination to display spelling suggestions using WhichKey
enabled = true, -- If this spelling plugin is enabled
suggestions = 20, -- how many suggestions should be shown in the list?
},
presets = {
Expand Down
3 changes: 2 additions & 1 deletion lua/which-key/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ local defaults = {
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
trigger = "z=" -- -- enabling this will show WhichKey when pressing z= to select spelling suggestions
enabled = true, -- If this spelling plugin is enabled
suggestions = 20, -- how many suggestions should be shown in the list?
},
presets = {
Expand Down
18 changes: 9 additions & 9 deletions lua/which-key/plugins/spelling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ local M = {}

M.name = "spelling"

M.mappings = {
{
"z=",
icon = { icon = " ", color = "red" },
plugin = "spelling",
desc = "Spelling Suggestions",
},
}

---@type table<string, any>
M.opts = {}

function M.setup(opts)
M.opts = opts

require("which-key.config").add({
{
M.opts.trigger,
icon = { icon = " ", color = "red" },
plugin = "spelling",
desc = "Spelling Suggestions",
},
})
end

function M.expand()
Expand Down
Loading