Giter Site home page Giter Site logo

window.nvim's Introduction

window.nvim

Deleting a buffer closes multiple windows? What's the next buffer that'll display in the window?

Make windows intuitive again.

Features

This plugin introduces the concept of opening and closing buffers in windows.

Windows are no longer just views. Instead, each window keeps a stack of buffers that determines the next buffer to display upon closing the active buffer. Use close_buf instead of manually deciding between hiding/deleting/wiping out a buffer.

We should, then, also expect the newly split window to not be in the same location as the original window. To do this, use split_win.

Installation

You can use any plugin manager. Below is an example with lazy.nvim along with helpful keymaps. Note that on setup, the plugin mandates the use of hidden buffers.

{
  "dseum/window.nvim",
  config = function()
    local window = require("window")
    window.setup()
    vim.keymap.set("n", "<Leader>ww", function()
      window.close_buf()
    end)
    vim.keymap.set("n", "<C-w>s", function()
      window.split_win({
        default_buffer = false,
      })
    end)
    vim.keymap.set("n", "<C-w>v", function()
      window.split_win({
        orientation = "v",
        default_buffer = false,
      })
    end)
  end
}

Configuration

setup has no configuration.

close_buf

Property Type Description
close_window boolean? Whether closing last buffer in window closes the window or loads the landing buffer.

split_win

Property Type Description
orientation "h" or "v" Horizontal or vertical.
default_buffer false or fun(split_winid: number) Default opens a landing buffer while false is Neovim's default. The callback loads a desired buffer.

Similar

window.nvim's People

Contributors

dseum avatar

Stargazers

 avatar  avatar hebe ⚸ dite avatar Yuta Katayama avatar

Watchers

 avatar

window.nvim's Issues

Use vim.fn.buflisted() to only handle important buffers

Heyo, just came over from reddit.
I noticed in your readme.md that you mention that you have issues with oil.nvim. Have you thought about using vim.fn.buflisted() to clear unlisted buffers off your buffer stack? That way, plugins like oil or nvim-tree won't pollute the buffer list.

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.