make color toggle global
This commit is contained in:
1 parent
fae2f73e60
commit
b154bdbbab
1 file changed
+13
-7
@@ -1204,17 +1204,23 @@ function M.toggle()
|
||||
opts
|
||||
)
|
||||
|
||||
-- Color highlighting
|
||||
-- Color highlighting (global)
|
||||
km.nmap(
|
||||
km.leader2 "tc",
|
||||
function()
|
||||
local hipatterns = require("mini.hipatterns")
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
hipatterns.toggle(bufnr)
|
||||
utils.notify_setting_enabled(
|
||||
"Color highlighting",
|
||||
vim.tbl_contains(hipatterns.get_enabled_buffers(), bufnr)
|
||||
)
|
||||
vim.g.minihipatterns_disable = not vim.g.minihipatterns_disable
|
||||
local enabled = not vim.g.minihipatterns_disable
|
||||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_loaded(bufnr) then
|
||||
if enabled then
|
||||
pcall(hipatterns.enable, bufnr)
|
||||
else
|
||||
pcall(hipatterns.disable, bufnr)
|
||||
end
|
||||
end
|
||||
end
|
||||
utils.notify_setting_enabled("Color highlighting", enabled)
|
||||
end,
|
||||
opts
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user