FIX: desactivate if not in tmux
This commit is contained in:
parent
74f4a0a4aa
commit
7a5bd54f16
1 changed files with 9 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ end
|
||||||
-- 📡 Synchroniser les couleurs avec Tmux selon le mode
|
-- 📡 Synchroniser les couleurs avec Tmux selon le mode
|
||||||
M.set_tmux_status = function(mode)
|
M.set_tmux_status = function(mode)
|
||||||
if not (is_tmux_installed() and is_in_tmux()) then
|
if not (is_tmux_installed() and is_in_tmux()) then
|
||||||
return -- 🔒 Ne fait rien si tmux n'est pas dispo
|
return -- Ne fait rien si tmux n'est pas dispo
|
||||||
end
|
end
|
||||||
|
|
||||||
local mode_colors = {
|
local mode_colors = {
|
||||||
|
|
@ -39,11 +39,16 @@ M.set_tmux_status = function(mode)
|
||||||
local color = mode_colors[mode] or get_hl_color("MiniStatuslineModeNormal", "bg")
|
local color = mode_colors[mode] or get_hl_color("MiniStatuslineModeNormal", "bg")
|
||||||
|
|
||||||
-- 🛠️ Commande silencieuse pour changer la couleur de Tmux
|
-- 🛠️ Commande silencieuse pour changer la couleur de Tmux
|
||||||
vim.fn.system({ "tmux", "set-option", "-g", "status-bg", color })
|
os.execute(string.format("tmux set-option -g status-bg '%s'", color))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 🔄 Détecte les changements de mode
|
-- Initialisation sécurisée : Ne rien lancer si Tmux est absent
|
||||||
if is_tmux_installed() and is_in_tmux() then
|
M.setup = function()
|
||||||
|
if not (is_tmux_installed() and is_in_tmux()) then
|
||||||
|
return -- Tmux absent ➔ on quitte
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Détecte les changements de mode
|
||||||
vim.api.nvim_create_autocmd("ModeChanged", {
|
vim.api.nvim_create_autocmd("ModeChanged", {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue