Code Monkey home page Code Monkey logo

zen-mode.nvim's Introduction

๐Ÿง˜ Zen Mode

Distraction-free coding for Neovim >= 0.5

image

โœจ Features

  • opens the current buffer in a new full-screen floating window
  • doesn't mess with existing window layouts / splits
  • works correctly with other floating windows, like LSP hover, WhichKey, ...
  • you can dynamically change the window size
  • realigns when the editor or Zen window is resized
  • optionally shade the backdrop of the Zen window
  • always hides the status line
  • optionally hide the number column, sign column, fold column, ...
  • highly customizable with lua callbacks on_open, on_close
  • plugins:
    • disable gitsigns
    • hide tmux status line
    • increase Kitty font-size
    • increase Alacritty font-size
  • Zen Mode is automatically closed when a new non-floating window is opened
  • works well with plugins like Telescope to open a new buffer inside the Zen window
  • close the Zen window with :ZenMode, :close or :quit

โšก๏ธ Requirements

  • Neovim >= 0.5.0
    • โ— Zen Mode uses the new z-index option for floating windows
    • โ— only builds newer than May 15, 2021 are supported
  • Twilight is optional to dim inactive portions of your code

๐Ÿ“ฆ Installation

Install the plugin with your preferred package manager:

-- Lua
use {
  "folke/zen-mode.nvim",
  config = function()
    require("zen-mode").setup {
      -- your configuration comes here
      -- or leave it empty to use the default settings
      -- refer to the configuration section below
    }
  end
}
" Vim Script
Plug 'folke/zen-mode.nvim'

lua << EOF
  require("zen-mode").setup {
    -- your configuration comes here
    -- or leave it empty to use the default settings
    -- refer to the configuration section below
  }
EOF

โš™๏ธ Configuration

Zen Mode comes with the following defaults:

{
  window = {
    backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
    -- height and width can be:
    -- * an absolute number of cells when > 1
    -- * a percentage of the width / height of the editor when <= 1
    -- * a function that returns the width or the height
    width = 120, -- width of the Zen window
    height = 1, -- height of the Zen window
    -- by default, no options are changed for the Zen window
    -- uncomment any of the options below, or add other vim.wo options you want to apply
    options = {
      -- signcolumn = "no", -- disable signcolumn
      -- number = false, -- disable number column
      -- relativenumber = false, -- disable relative numbers
      -- cursorline = false, -- disable cursorline
      -- cursorcolumn = false, -- disable cursor column
      -- foldcolumn = "0", -- disable fold column
      -- list = false, -- disable whitespace characters
    },
  },
  plugins = {
    -- disable some global vim options (vim.o...)
    -- comment the lines to not apply the options
    options = {
      enabled = true,
      ruler = false, -- disables the ruler text in the cmd line area
      showcmd = false, -- disables the command in the last line of the screen
    },
    twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
    gitsigns = { enabled = false }, -- disables git signs
    tmux = { enabled = false }, -- disables the tmux statusline
    -- this will change the font size on kitty when in zen mode
    -- to make this work, you need to set the following kitty options:
    -- - allow_remote_control socket-only
    -- - listen_on unix:/tmp/kitty
    kitty = {
      enabled = false,
      font = "+4", -- font size increment
    },
    -- this will change the font size on alacritty when in zen mode
    -- requires  Alacritty Version 0.10.0 or higher
    -- uses `alacritty msg` subcommand to change font size
    alacritty = {
      enabled = false,
      font = "14", -- font size
    },
  },
  -- callback where you can add custom code when the Zen window opens
  on_open = function(win)
  end,
  -- callback where you can add custom code when the Zen window closes
  on_close = function()
  end,
}

๐Ÿš€ Usage

Toggle Zen Mode with :ZenMode.

Alternatively you can start Zen Mode with the Lua API and pass any additional options:

require("zen-mode").toggle({
  window = {
    width = .85 -- width will be 85% of the editor width
  }
})

Inspiration

zen-mode.nvim's People

Contributors

folke avatar github-actions[bot] avatar anatolelucet avatar mendes-davi avatar meijieru avatar marcelbeumer avatar mattspalmer avatar nasanos avatar nmrnv avatar wieerd avatar xxiaoa avatar coinator avatar shiradofu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.