index : neolij.nvim
Seamless Neovim/Zellij integration with built-in navigation, pane/tab management, and Lua scripting.
about summary refs log tree commit diff

Diffstat (limited to 'README.md')

-rw-r--r-- README.md 126
 1 file changed, 83 insertions(+), 43 deletions(-)

diff --git a/README.md b/README.md
index a3207ac..8b3aa32 100644
--- a/README.md
+++ b/README.md
@@ -1,93 +1,133 @@
# zellij.nvim
# Neolij.nvim
A lightweight Neovim plugin that integrates Neovim window navigation with [Zellij](https://zellij.dev/). If Neovim can’t move to another window, it automatically falls back to Zellij actions.
giving you seamless navigation between Neovim splits and Zellij panes/tabs
## Installing
### lazyvim
```lua
{
   "y2w8/zellij.nvim",
   "y2w8/neolij.nvim",
    event = "VeryLazy",
    opts = {}, -- Important even if empty
    keys = {
    -- Window navigation
    { "<C-k>", ":ZellijUp<CR>", mode = { "n", "t" }, desc = "Move up", silent = true  },
    { "<C-j>", ":ZellijDown<CR>", mode = { "n", "t" }, desc = "Move down", silent = true  },
    { "<C-h>", ":ZellijLeftTab<CR>", mode = { "n", "t" }, desc = "Move left", silent = true  },
    { "<C-l>", ":ZellijRightTab<CR>", mode = { "n", "t" }, desc = "Move right", silent = true  },
    { "<C-k>", ":NeolijUp<CR>", mode = { "n", "t" }, desc = "Move up", silent = true  },
    { "<C-j>", ":NeolijDown<CR>", mode = { "n", "t" }, desc = "Move down", silent = true  },
    { "<C-h>", ":NeolijLeftTab<CR>", mode = { "n", "t" }, desc = "Move left", silent = true  },
    { "<C-l>", ":NeolijRightTab<CR>", mode = { "n", "t" }, desc = "Move right", silent = true  },

    -- Tab actions
    { "<leader>zt", ":ZellijNewTab<CR>", desc = "New Zellij Tab", silent = true  },
    { "<leader>zr", ":ZellijRenameTab<CR>", desc = "Rename Zellij Tab", silent = true  },
    { "<leader>zl", ":ZellijMoveTabLeft<CR>", desc = "Move Tab Left", silent = true  },
    { "<leader>zL", ":ZellijMoveTabRight<CR>", desc = "Move Tab Right", silent = true  },
    { "<leader>zt", ":NeolijNewTab<CR>", desc = "New Zellij Tab", silent = true  },
    { "<leader>zr", ":NeolijRenameTab<CR>", desc = "Rename Zellij Tab", silent = true  },
    { "<leader>zl", ":NeolijMoveTabLeft<CR>", desc = "Move Tab Left", silent = true  },
    { "<leader>zL", ":NeolijMoveTabRight<CR>", desc = "Move Tab Right", silent = true  },

    -- Pane actions
    { "<leader>zp", ":ZellijNewPane -d right<CR>", desc = "New Zellij Pane vertical", silent = true  },
    { "<leader>zP", ":ZellijNewPane -d down<CR>", desc = "New Zellij Pane horizontal", silent = true  },
    { "<leader>zf", ":ZellijNewPane -f<CR>", desc = "New Zellij Floating Pane", silent = true  },
    { "<leader>zn", ":ZellijRenamePane<CR>", desc = "Rename Zellij Pane", silent = true  },
    { "<leader>zu", ":ZellijMovePaneUp<CR>", desc = "Move Pane Up", silent = true  },
    { "<leader>zd", ":ZellijMovePaneDown<CR>", desc = "Move Pane Down", silent = true  },
    { "<leader>zh", ":ZellijMovePaneLeft<CR>", desc = "Move Pane Left", silent = true  },
    { "<leader>zR", ":ZellijMovePaneRight<CR>", desc = "Move Pane Right", silent = true  },
    { "<leader>zp", ":NeolijNewPane -d right<CR>", desc = "New Zellij Pane vertical", silent = true  },
    { "<leader>zP", ":NeolijNewPane -d down<CR>", desc = "New Zellij Pane horizontal", silent = true  },
    { "<leader>zf", ":NeolijNewPane -f<CR>", desc = "New Zellij Floating Pane", silent = true  },
    { "<leader>zn", ":NeolijRenamePane<CR>", desc = "Rename Zellij Pane", silent = true  },
    { "<leader>zu", ":NeolijMovePaneUp<CR>", desc = "Move Pane Up", silent = true  },
    { "<leader>zd", ":NeolijMovePaneDown<CR>", desc = "Move Pane Down", silent = true  },
    { "<leader>zh", ":NeolijMovePaneLeft<CR>", desc = "Move Pane Left", silent = true  },
    { "<leader>zR", ":NeolijMovePaneRight<CR>", desc = "Move Pane Right", silent = true  },
  },
}
```

### Zellij
```kdl

keybinds clear-defaults=true {
    shared_except "locked" {
        bind "Ctrl left" { MoveFocusOrTab "left"; }
        bind "Ctrl down" { MoveFocus "down"; }
        bind "Ctrl up" { MoveFocus "up"; }
        bind "Ctrl right" { MoveFocusOrTab "right"; }
    }
}

plugins {
    // Required
    autolock location="https://github.com/fresh2dev/zellij-autolock/releases/latest/download/zellij-autolock.wasm" {
        // Enabled at start?
        is_enabled true
        // Lock when any open these programs open.
        triggers "nvim|vim"
        // Reaction to input occurs after this many seconds. (default=0.3)
        // (An existing scheduled reaction prevents additional reactions.)
        reaction_seconds "0.3"
        // Print to Zellij log? (default=false)
        print_to_log false
    }
}

// Plugins to load in the background when a new session starts
load_plugins {
    autolock
}

```


## Commands
### Navigation
| Command | Function | Description |
| --------------- | --------------- | --------------- |
| `:ZellijUp` | require("zellij").move("up") | Move up |
| `:ZellijDown` | require("zellij").move("down") | Move down |
| `:ZellijLeft` | require("zellij").move("left") | Move left |
| `:ZellijRight` | require("zellij").move("right") | Move right |
| `:ZellijLeftTab` | require("zellij").move_or_tab("left", false) | Move left or switch tab (zellij tabs) |
| `:ZellijRightTab` | require("zellij").move_or_tab("right", false) | Move right or switch tab (zellij tabs) |
| `:ZellijLeftSmart` | require("zellij").move_or_tab("left", true) | Move left or switch tab (nvim tab or zellij tab) |
| `:ZellijRightSmart` | require("zellij").move_or_tab("right", true) | Move right or switch tab (nvim tab or zellij tab) |
| `:NeolijUp` | require("neolij").move("up") | Move up |
| `:NeolijDown` | require("neolij").move("down") | Move down |
| `:NeolijLeft` | require("neolij").move("left") | Move left |
| `:NeolijRight` | require("neolij").move("right") | Move right |
| `:NeolijLeftTab` | require("neolij").move_or_tab("left", false) | Move left or switch tab (zellij tabs) |
| `:NeolijRightTab` | require("neolij").move_or_tab("right", false) | Move right or switch tab (zellij tabs) |
| `:NeolijLeftSmart` | require("neolij").move_or_tab("left", true) | Move left or switch tab (nvim tab or zellij tab) |
| `:NeolijRightSmart` | require("neolij").move_or_tab("right", true) | Move right or switch tab (nvim tab or zellij tab) |


### Tab Managment
> [!TIP]
> If `name` is not provided, you will be prompted for input.
> type this in the terminal to see options

> [!TIP]
> type this in the terminal to see possible arguments
> ```sh
> zellij action new-tab --help
> ```

| Command | Function | Description |
| --------------- | --------------- | --------------- |
| `:ZellijNewTab [args?]` | require("zellij").new_tab(args?) | Create new tab |
| `:ZellijRenameTab [name?]` | require("zellij").rename_tab(name?) | Rename current zellij tab  |
| `:ZellijMoveTabLeft` | require("zellij").move_tab("left") | Move tab left |
| `:ZellijMoveTabRight` | require("zellij").move_tab("right") | Move tab right |
| `:NeolijNewTab [args?]` | require("neolij").new_tab(args?) | Create new tab |
| `:NeolijRenameTab [name?]` | require("neolij").rename_tab(name?) | Rename current zellij tab  |
| `:NeolijMoveTabLeft` | require("neolij").move_tab("left") | Move tab left |
| `:NeolijMoveTabRight` | require("neolij").move_tab("right") | Move tab right |


### Pane Managment
> [!TIP]
> If `name` is not provided, you will be prompted for input. 
> type this in the terminal to see options

> [!TIP]
> type this in the terminal to see possible arguments
> ```sh
> zellij action new-pane --help
> ```

| Command | Function | Description |
| --------------- | --------------- | --------------- |
| `:ZellijNewPane [args?]` | require("zellij").new_pane(args?) | Create new pane |
| `:ZellijRenamePane [name?]` | require("zellij").rename_pane(name?) | Rename current zellij pane  |
| `:ZellijMovePaneUp` | require("zellij").move_pane("up") | Move pane up |
| `:ZellijMovePaneDown` | require("zellij").move_pane("down") | Move pane down |
| `:ZellijMovePaneLeft` | require("zellij").move_pane("left") | Move pane left |
| `:ZellijMovePaneRight` | require("zellij").move_pane("right") | Move pane right |
| `:NeolijNewPane [args?]` | require("neolij").new_pane(args?) | Create new pane |
| `:NeolijRenamePane [name?]` | require("neolij").rename_pane(name?) | Rename current zellij pane  |
| `:NeolijMovePaneUp` | require("neolij").move_pane("up") | Move pane up |
| `:NeolijMovePaneDown` | require("neolij").move_pane("down") | Move pane down |
| `:NeolijMovePaneLeft` | require("neolij").move_pane("left") | Move pane left |
| `:NeolijMovePaneRight` | require("neolij").move_pane("right") | Move pane right |

### Custom
You can run any zellij action using:
```lua
require("zellij").zellij_action("toggle-fullscreen")
require("neolij").zellij_action("toggle-fullscreen")
```

> [!TIP]
> type this in terminal to see possible action 
> type this in terminal to see possible actions 
>```sh
>zellij action help
>```
@@ -95,7 +135,7 @@
#### Examples
##### Toggle fullscreen for the current zellij pane
```lua
require("zellij").zellij_action("toggle-fullscreen")
require("neolij").zellij_action("toggle-fullscreen")
```

##### Create a pane while asking for direction and name:
@@ -123,9 +163,9 @@
      args = args .. " -n " .. name
    end

    require("zellij").new_pane({ args = args })
    require("neolij").new_pane({ args = args })
  end,
  { desc = "Zellij: New pane (ask direction & name)" }
  { desc = "Neolij: New pane (ask direction & name)" }
)

```