From b264921aa5c21350a982130629ca1311310d174d Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 9 Jul 2024 06:35:04 -0300 Subject: [PATCH] neovim: add zen-mode --- programs/neovim/lua/community.lua | 1 + programs/wezterm/default.nix | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/programs/neovim/lua/community.lua b/programs/neovim/lua/community.lua index 5ec0465..4a34756 100644 --- a/programs/neovim/lua/community.lua +++ b/programs/neovim/lua/community.lua @@ -16,6 +16,7 @@ return { }, { import = "astrocommunity.editing-support.todo-comments-nvim" }, + { import = "astrocommunity.editing-support.zen-mode-nvim" }, { import = "astrocommunity.motion.flash-nvim" }, { import = "astrocommunity.motion.flit-nvim" }, diff --git a/programs/wezterm/default.nix b/programs/wezterm/default.nix index 599ccfa..90d4e94 100644 --- a/programs/wezterm/default.nix +++ b/programs/wezterm/default.nix @@ -7,6 +7,30 @@ '' local wezterm = require("wezterm") + -- Needed for folke's ZenMode in neovim + wezterm.on('user-var-changed', function(window, pane, name, value) + local overrides = window:get_config_overrides() or {} + if name == "ZEN_MODE" then + local incremental = value:find("+") + local number_value = tonumber(value) + if incremental ~= nil then + while (number_value > 0) do + window:perform_action(wezterm.action.IncreaseFontSize, pane) + number_value = number_value - 1 + end + overrides.enable_tab_bar = false + elseif number_value < 0 then + window:perform_action(wezterm.action.ResetFontSize, pane) + overrides.font_size = nil + overrides.enable_tab_bar = true + else + overrides.font_size = number_value + overrides.enable_tab_bar = false + end + end + window:set_config_overrides(overrides) + end) + return { color_scheme = "Catppuccin Frappe", enable_wayland = false, -- Unfortunately broken on Hyprland, AGAIN