An open API service indexing awesome lists of open source software.

https://github.com/spaceshaman/window-shuffler.nvim

Smartly shuffle Neovim windows around – layout-aware and intuitive.
https://github.com/spaceshaman/window-shuffler.nvim

neovim neovim-plugin nvim nvim-plugin vim

Last synced: 2 months ago
JSON representation

Smartly shuffle Neovim windows around – layout-aware and intuitive.

Awesome Lists containing this project

README

          

window-shuffler.nvim

Smartly shuffle Neovim windows around – layout-aware and intuitive.

## Features

* Move the current **window** in any direction: left, right, up, or down.
* Automatically finds the best possible placement based on existing layout.
* Respects window dimensions to keep your layout clean and consistent.
* Simple setup with fully customizable keymaps.

## Installation

Using [packer](https://github.com/wbthomason/packer.nvim):

```lua
use { "SpaceShaman/window-shuffler.nvim", tag = "*", config = function()
require("window-shuffler").setup()
end }
```

Using [lazy.nvim](https://github.com/folke/lazy.nvim):

```lua
{
"SpaceShaman/window-shuffler.nvim",
version = "*",
opts = {
-- Optional custom keymaps
},
}
```

Using [vim-plug](https://github.com/junegunn/vim-plug):

```vim
Plug 'SpaceShaman/window-shuffler.nvim', {'tag': '*'}

lua require("window-shuffler").setup()
```

You can (and should) pin the plugin to a tag to avoid breaking changes as development continues.

## Configuration

You can configure the plugin by passing a table to the `setup()` function:

```lua
require("window-shuffler").setup({
keymaps = {
left = "H",
down = "J",
up = "K",
right = "L",
},
})
```

Or by using the `opts` field in your lazy.nvim config:

```lua
{
"SpaceShaman/window-shuffler.nvim",
opts = {
keymaps = {
left = "H",
down = "J",
up = "K",
right = "L",
},
},
}
```

### `keymaps`

A table of keybindings for directional movement. Default values are:

* `H`: Move current window to the left.
* `J`: Move current window downward.
* `K`: Move current window upward.
* `L`: Move current window to the right.

## How it works

When you trigger a directional move, the plugin searches for the most logical location in that direction – for example, it may go around obstacles to maintain the layout's flow. It ensures the moved window integrates cleanly with the rest of your layout.