feat: add support for vim-zellij-navigator.
2 files changed, 115 insertions(+), 2 deletions(-)
@@ -35,8 +35,12 @@
```
### Zellij
```kdl
<details>
<summary>Autolock plugin</summary>
```kdl
keybinds clear-defaults=true {
shared_except "locked" {
bind "Ctrl left" { MoveFocusOrTab "left"; }
@@ -59,14 +63,107 @@
// Print to Zellij log? (default=false)
print_to_log false
}
// OR
vim_zellij_navigator location="https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm"
}
// Plugins to load in the background when a new session starts
load_plugins {
autolock
}
```
</details>
<details>
<summary>vim-zellij-navigator plugin</summary>
> [!NOTE]
> if you use `vim-zellij-navigator` you have to set `vim_zellij_navigator = true` in the configuration.
> ```lua
> require("neolij").setup({
> vim_zellij_navigator = true
> })
> ```
```kdl
keybinds clear-defaults=true {
shared_except "locked" {
bind "Ctrl j" {
MessagePlugin "vim_zellij_navigator" {
name "move_focus";
payload "down";
move_mod "ctrl";
use_arrow_keys "false";
};
}
bind "Ctrl k" {
MessagePlugin "vim_zellij_navigator" {
name "move_focus";
payload "up";
move_mod "ctrl";
use_arrow_keys "false";
};
}
bind "Ctrl l" {
MessagePlugin "vim_zellij_navigator" {
name "move_focus_or_tab";
payload "right";
move_mod "ctrl"; // Optional, should be added on every command if you want to use it
use_arrow_keys "false";
};
}
bind "Alt h" {
MessagePlugin "vim_zellij_navigator" {
name "resize";
payload "left";
resize_mod "alt";
};
}
bind "Alt j" {
MessagePlugin "vim_zellij_navigator" {
name "resize";
payload "down";
resize_mod "alt";
};
}
bind "Alt k" {
MessagePlugin "vim_zellij_navigator" {
name "resize";
payload "up";
resize_mod "alt";
};
}
bind "Alt l" {
MessagePlugin "vim_zellij_navigator" {
name "resize";
payload "right";
resize_mod "alt";
};
}
}
}
plugins {
vim_zellij_navigator location="https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm"
}
```
</details>
## Commands
@@ -6,6 +6,14 @@
left = "h",
right = "l",
}
local default_config = {
-- if use vim-zellij-navigator plugin set this to true.
vim_zellij_navigator = false
}
M.config = {}
-- Run zellij action safely
function M.zellij_action(args)
if not os.getenv("ZELLIJ") then
@@ -125,7 +133,15 @@
end
-- Setup user commands
function M.setup()
function M.setup(user_config)
M.config = vim.tbl_deep_extend("force", default_config, user_config or {})
if M.config.vim_zellij_navigator then
vim.fn.jobstart('zellij pipe -n "nvim_hook" "open"')
vim.api.nvim_create_autocmd({"VimLeavePre"}, {
pattern = {"*"},
command = 'zellij pipe -n "nvim_hook" "close"'
})
end
vim.api.nvim_create_user_command("NeolijUp", function()
M.move("up")
end, {})