Skip to content

sand4rt/zen.nvim

Repository files navigation

🧘🏼‍♂️ zen.nvim

zen mode by https://github.com/alex35mil/dotfiles

Capabilities

  • Simple plugin that centers the main buffer.
  • Compatible with side buffer plugins (like neo-tree.nvim).
  • Automatically toggles side buffers whenever a side buffer is opened/closed without flickering.
  • Responsive during resizing.
  • Supports tabs, horizontal and vertical splits.
  • Layout and positioning options.
  • Removes the need for a visual guide showing the maximum line width (ColorColumn).
  • Reduces neck strain and improves focus.

Usage

Using Lazy.nvim
return {
  "sand4rt/zen.nvim",
  lazy = false,
  opts = {
    main = {
      width = 148, -- or vim.wo.colorcolumn
    },
    -- TIP: find a buffer's filetype with :lua print(vim.bo.filetype)
    top = {
      { filetype = "man" },
      { filetype = "help" },
      { filetype = "fugitive" },
    },
    right = {
      { filetype = "*", min_width = 46 },
      { filetype = "copilot-chat", min_width = 60 },
      { filetype = "neotest-summary" },
      { filetype = { "dapui_watches", "dapui_scopes", "dapui_stacks", "dapui_breakpoints" } },
    },
    bottom = {
      { filetype = "dap-repl" },
      { filetype = "qf" },
      { filetype = "trouble" },
      { filetype = "noice" }, -- noice opens large notifications in a buffer
    },
    left = {
      { filetype = "*", min_width = 46 },
      { filetype = "fugitiveblame" },
      { filetype = "fyler" },
      { filetype = "neotree" },
      { filetype = "dbui" },
      { filetype = { "undotree", "diff" } },
    },
  },
}
Using Nix NVF
programs.nvf.settings.vim.lazy.plugins = {
  "zen.nvim" = {
    package = pkgs.vimUtils.buildVimPlugin {
      pname = "zen.nvim";
      version = "1.0.0";
      src = pkgs.fetchFromGitHub {
        owner = "sand4rt";
        repo = "zen.nvim";
        rev = "v1.0.0";
        sha256 = "sha256-SVDf8K/eo8N9Hrx2rzMnW2uBDGWaJ8TZZNB/qdfJPfE=";
      };
    };
    event = [ "BufEnter" ];
    setupModule = "zen";
    setupOpts = {
      main = {
        width = 148;
      };
      # TIP: find a buffer's filetype with :lua print(vim.bo.filetype)
      top = [
        { filetype = "fugitive"; }
        { filetype = "git"; }
        { filetype = "man"; }
        { filetype = "help"; }
        { filetype = "gitcommit"; }
      ];
      right = [
        { filetype = "*"; min_width = 46; }
        { filetype = "copilot-chat"; min_width = 60; }
        { filetype = "neotest-summary"; }
        { filetype = [ "dapui_watches" "dapui_scopes" "dapui_stacks" "dapui_breakpoints" ]; }
      ];
      bottom = [
        { filetype = "dap-repl"; }
        { filetype = "qf"; }
        { filetype = "trouble"; }
        { filetype = "noice"; } # noice opens large notifications in a buffer
      ];
      left = [
        { filetype = "*"; min_width = 46; }
        { filetype = "fugitiveblame"; }
        { filetype = "fyler"; }
        { filetype = "neotree"; }
        { filetype = "dbui"; }
        { filetype = [ "undotree" "diff" ]; }
      ];
    };
  };
};

Credits to other plugins for inspiration

About

Centers the main buffer to reduce neck strain and improve focus

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors