A minimal Neovim plugin for distraction-free coding. It creates a centered floating window with customizable width, height, and z-index, hiding UI elements and focusing your attention.
- Centered floating window for the current buffer
- Customizable width, height, and z-index
- Background dimming
- Toggle Zen mode on/off
- Works with Neovim 0.5+ (requires floating window zindex support)
With Lazy.nvim:
{
"Raist90/zen.nvim",
name = "Zen",
event = "BufEnter",
config = function()
require("zen").setup({
window = {
width = 120,
height = 1,
},
zindex = 40,
})
vim.keymap.set("n", "<leader>Z", function()
require("zen").toggle()
end, { desc = "Toggle Zen Mode" })
end,
}- Press
<leader>Zin normal mode to toggle Zen mode. - Customize
width,height, andzindexin the setup function.
require("zen").setup(opts)— Configure Zen mode.require("zen").toggle()— Toggle Zen mode.require("zen").open(opts)— Open Zen mode.require("zen").close()— Close Zen mode.
{
window = {
width = 120, -- or a function returning a number
height = 1, -- or a function returning a number
},
zindex = 40,
}- Neovim 0.5+ (May 2021 or newer, for floating window zindex support)
- Run
:checkhealth zento verify your setup and diagnose issues
MIT
You can adjust the installation path and keymap as needed.