---
title: "zen.lua"
date: "12/12/2025"
---

[zen-mode.nvim](https://github.com/folke/zen-mode.nvim), no plugin needed.

```lua
local state = nil

vim.keymap.set('n', '<leader>iz', function()
  if state then
    for k, v in pairs(state) do
      vim.opt[k] = v
    end
    state = nil
  else
    state = {
      number = opt.number:get(),
      relativenumber= opt.relativenumber:get(),
      signcolumn = opt.signcolumn:get(),
      statuscolumn = opt.statuscolumn:get(),
      laststatus = opt.laststatus:get(),
      cmdheight = opt.cmdheight:get(),
    }
    vim.opt.number = false
    vim.opt.relativenumber = false
    vim.opt.signcolumn = "no"
    vim.opt.statuscolumn = ""
    vim.opt.laststatus = 0
    vim.opt.cmdheight = 0
  end
end, { desc = "Toggle Zen Mode" })
```
