mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 17:58:51 +02:00
feat(keymaps): dynamic which-key icons/descriptions for toggles (#4050)
## Description <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Related Issue(s) - [ ] Closes #4025 ## Screenshots  ## Checklist - [ ] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
parent
706ec4b6b6
commit
78cf0320bf
9 changed files with 217 additions and 131 deletions
|
@ -97,10 +97,19 @@ end
|
|||
|
||||
---@param buf? boolean
|
||||
function M.toggle(buf)
|
||||
M.enable(not M.enabled(), buf)
|
||||
end
|
||||
|
||||
---@param enable? boolean
|
||||
---@param buf? boolean
|
||||
function M.enable(enable, buf)
|
||||
if enable == nil then
|
||||
enable = true
|
||||
end
|
||||
if buf then
|
||||
vim.b.autoformat = not M.enabled()
|
||||
vim.b.autoformat = enable
|
||||
else
|
||||
vim.g.autoformat = not M.enabled()
|
||||
vim.g.autoformat = enable
|
||||
vim.b.autoformat = nil
|
||||
end
|
||||
M.info()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue