Compare commits

..
18 Commits
Author SHA1 Message Date
swaits 62a4e161c9 chore: repoint remaining links at git.swaits.com
Rewrites lingering github.com / *.sr.ht references to this Gitea instance,
translating GitHub and Sourcehut URL shapes to Gitea's (/blob/<ref>/ and
sr.ht /tree/<ref>/item/ -> /src/branch/<ref>/, /tree/<tag> -> /src/tag/<tag>,
/actions/workflows/X -> /actions?workflow=X, /edit/ -> /_edit/).

Left pointing at the old hosts on purpose: pull-request links (PRs were not
migrated), forks that were never migrated, and GitHub-only surfaces Gitea
lacks. OpenPGP identity proofs are untouched by design.
2026-08-31 18:32:37 -06:00
swaits 59e49cad95 chore: remove Sourcehut CI manifest
Migrated to git.swaits.com; Sourcehut builds no longer run.
2026-08-31 17:16:50 -06:00
swaits 91cc2a642d Merge pull request #10 from jaidetree/patch-1 2025-01-21 23:14:16 -07:00
jaide (formerly eccentric-j) 3ca790ee34 Update package URLs in Readme
Updates package URLs in readme to point to the github repo URL
2025-01-21 20:29:01 -05:00
swaits 366935eeb5 Merge pull request #8 from MBA380/main 2024-12-24 04:26:53 -07:00
MBA380 8a595653a9 Update README.md to remove zellij bug disclaimer as it has been fixed 2024-12-24 11:51:56 +04:00
swaits 346cd5e1ab Merge pull request #5 from marcosktsz/main
Removing deprecated methods on checkhealth
2024-11-14 17:26:12 -08:00
swaits 0c192fb18b Merge pull request #6 from HirschBerge/patch-1 2024-11-13 18:42:00 -08:00
Berge della Hirsch e216aeebae Correct the Readme
Section on zellij config is very out of date. Includes zellij plugin and instruction to assist users with configuration to achieve on harmonic set of navigation binds.
2024-11-13 18:29:02 -05:00
Marco Caceffo ede42a5ac0 Removing deprecated methods on checkhealth 2024-11-13 23:42:10 +01:00
swaits 1d6657d8b8 chore: forced re-merge 2024-10-29 12:18:59 -06:00
swaits 511e9b7bb7 Merge remote-tracking branch 'github/GiuseppeMP/main'
* github/GiuseppeMP/main:
  chore: update healthcheck for new API
  (chore): updated health.lua to use the new 0.11 api. (#2)
2024-09-03 14:41:22 -06:00
swaits 2e6cbe6ab1 chore: update healthcheck for new API 2024-09-03 14:19:45 -06:00
Shi Han NG 4fa0225331 Update README to mention *Tab 2024-08-31 07:54:50 +09:00
Shi Han NG 5c588a0918 Add ZellijNavigate*Tab commands 2024-08-31 07:49:55 +09:00
Shi Han NG e11d413ed2 Fix error when user command calls nav 2024-07-13 16:08:20 +09:00
Shi Han NG 2bc42accec Allow move-focus-or-tab as action 2024-07-11 21:04:45 +09:00
Peppe d452fe37f0 (chore): updated health.lua to use the new 0.11 api. (#2) 2024-07-02 12:09:22 -03:00
4 changed files with 77 additions and 49 deletions

No files matched your search

-11
View File
@@ -1,11 +0,0 @@
image: alpine/edge
secrets:
- 88cce185-d2ec-4573-9546-e33f36f79bbf
sources:
- git+ssh://git@git.sr.ht/~swaits/zellij-nav.nvim
tasks:
- mirror-to-github: |
cd ~/zellij-nav.nvim
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote add github git@github.com:swaits/zellij-nav.nvim.git
git push --mirror github
+34 -29
View File
@@ -13,6 +13,10 @@ Commands:
- `ZellijNavigateDown`
- `ZellijNavigateUp`
- `ZellijNavigateRight`
- `ZellijNavigateLeftTab`
- `ZellijNavigateDownTab`
- `ZellijNavigateUpTab`
- `ZellijNavigateRightTab`
It also exports the `lua` versions, which you can call like this:
@@ -20,6 +24,10 @@ It also exports the `lua` versions, which you can call like this:
- `require("zellij-nav").down()`
- `require("zellij-nav").up()`
- `require("zellij-nav").right()`
- `require("zellij-nav").left_tab()`
- `require("zellij-nav").down_tab()`
- `require("zellij-nav").up_tab()`
- `require("zellij-nav").right_tab()`
This is written in the spirit of
[vim-tmux-navigator](https://github.com/alexghergh/nvim-tmux-navigation/), but
@@ -32,14 +40,14 @@ possible.
```lua
{
"https://git.sr.ht/~swaits/zellij-nav.nvim",
"swaits/zellij-nav.nvim",
lazy = true,
event = "VeryLazy",
keys = {
{ "<c-h>", "<cmd>ZellijNavigateLeft<cr>", { silent = true, desc = "navigate left" } },
{ "<c-h>", "<cmd>ZellijNavigateLeftTab<cr>", { silent = true, desc = "navigate left or tab" } },
{ "<c-j>", "<cmd>ZellijNavigateDown<cr>", { silent = true, desc = "navigate down" } },
{ "<c-k>", "<cmd>ZellijNavigateUp<cr>", { silent = true, desc = "navigate up" } },
{ "<c-l>", "<cmd>ZellijNavigateRight<cr>", { silent = true, desc = "navigate right" } },
{ "<c-l>", "<cmd>ZellijNavigateRightTab<cr>", { silent = true, desc = "navigate right or tab" } },
},
opts = {},
}
@@ -49,15 +57,15 @@ possible.
```lua
{
"https://git.sr.ht/~swaits/zellij-nav.nvim",
"https://git.swaits.com/swaits/zellij-nav.nvim",
config = function()
require("zellij-nav").setup()
local map = vim.keymap.set
map("n", "<c-h>", "<cmd>ZellijNavigateLeft<cr>", { desc = "navigate left" })
map("n", "<c-h>", "<cmd>ZellijNavigateLeftTab<cr>", { desc = "navigate left or tab" })
map("n", "<c-j>", "<cmd>ZellijNavigateDown<cr>", { desc = "navigate down" })
map("n", "<c-k>", "<cmd>ZellijNavigateUp<cr>", { desc = "navigate up" })
map("n", "<c-l>", "<cmd>ZellijNavigateRight<cr>", { desc = "navigate right" })
map("n", "<c-l>", "<cmd>ZellijNavigateRightTab<cr>", { desc = "navigate right or tab" })
end
}
@@ -66,7 +74,7 @@ possible.
### [vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'https://git.sr.ht/~swaits/zellij-nav.nvim'
Plug 'https://git.swaits.com/swaits/zellij-nav.nvim'
lua require("zellij-nav").setup()
nnoremap <c-h> <cmd>ZellijNavigateLeft<cr>
@@ -80,28 +88,25 @@ nnoremap <c-l> <cmd>ZellijNavigateRight<cr>
This plugin only covers the Neovim side of things. To achieve a fully seamless
workflow, we also need zellij to perform a few tasks.
In an ideal scenario, we would be able to map `C-hjkl` to function identically
in both zellij and Neovim, but unfortunately, that is not possible. Currently,
zellij has a few issues that prevent us from reaching that point.
Firstly, zellij does not allow us to bind `C-j` to any function. This is a
[known bug](https://github.com/zellij-org/zellij/issues/2679).
Secondly, and more importantly, when any of the `C-hjkl` keystrokes are used in
zellij, we need to be able to:
1. Determine if the focused pane is running `nvim`.
2. If it is, forward the keystrokes to the application, for example, by using
the zellij `Write` action.
3. If it is not, directly perform the keystroke action in zellij by using the
`MoveFocus <direction>` action.
Currently, I have not found a way to accomplish this, even through the zellij
[plugin system](https://zellij.dev/documentation/plugins).
Therefore, my configuration uses `A-hjkl` in zellij. As a result, I use
`C-hjkl` to navigate within Neovim and to switch from Neovim to another zellij
pane. However, if I'm in a non-`nvim` pane, I use `A-hjkl` to change focus.
When an instance of neovim is active, change zellij into lock mode using [zellij-autoloc](https://github.com/fresh2dev/zellij-autolock).
an example section of the config could be
```
...
autolock location="https://github.com/fresh2dev/zellij-autolock/releases/latest/download/zellij-autolock.wasm" {
triggers "nvim|vim|v|nv" // Lock when any open these programs open. They are expected to unlock themselves when closed (e.g., using zellij.vim plugin).
watch_triggers "fzf|zoxide|atuin|atac" // Lock when any of these open and monitor until closed.
watch_interval "1.0" // When monitoring, check every X seconds.
}
...
```
And to achieve unlocking when neovim is unfocused, you can add the following to your neovim config:
```lua
-- NOTE: Ensures that when exiting NeoVim, Zellij returns to normal mode
vim.api.nvim_create_autocmd("VimLeave", {
pattern = "*",
command = "silent !zellij action switch-mode normal"
})
```
## MIT License
+7 -3
View File
@@ -1,12 +1,16 @@
local M = {}
M.check = function()
vim.health.report_start("zellij-nav.nvim")
local start = vim.health.start
local report_ok = vim.health.ok
local report_error = vim.health.error
start("zellij-nav.nvim")
local version = vim.fn.system("zellij --version")
if vim.v.shell_error ~= 0 then
vim.health.report_error("zellij executable not found in user's path")
report_error("zellij executable not found in user's path")
else
vim.health.report_ok("found zellij version " .. string.gsub(version, "zellij ", ""))
report_ok("found zellij version " .. string.gsub(version, "zellij ", ""))
end
end
+36 -6
View File
@@ -1,6 +1,15 @@
local M = {}
local function nav(short_direction, direction)
local function nav(short_direction, direction, action)
-- Use "move-focus" if action is nil.
if not action then
action = "move-focus"
end
if action ~= "move-focus" and action ~= "move-focus-or-tab" then
error("invalid action: " .. action)
end
-- get window ID, try switching windows, and get ID again to see if it worked
local cur_winnr = vim.fn.winnr()
vim.api.nvim_command("wincmd " .. short_direction)
@@ -8,7 +17,7 @@ local function nav(short_direction, direction)
-- if the window ID didn't change, then we didn't switch
if cur_winnr == new_winnr then
vim.fn.system("zellij action move-focus " .. direction)
vim.fn.system("zellij action " .. action .. " " .. direction)
if vim.v.shell_error ~= 0 then
error("zellij executable not found in path")
end
@@ -16,19 +25,35 @@ local function nav(short_direction, direction)
end
function M.up()
nav("k", "up")
nav("k", "up", nil)
end
function M.down()
nav("j", "down")
nav("j", "down", nil)
end
function M.right()
nav("l", "right")
nav("l", "right", nil)
end
function M.left()
nav("h", "left")
nav("h", "left", nil)
end
function M.up_tab()
nav("k", "up", "move-focus-or-tab")
end
function M.down_tab()
nav("j", "down", "move-focus-or-tab")
end
function M.right_tab()
nav("l", "right", "move-focus-or-tab")
end
function M.left_tab()
nav("h", "left", "move-focus-or-tab")
end
-- create our exported setup() function
@@ -38,6 +63,11 @@ function M.setup(opts)
vim.api.nvim_create_user_command("ZellijNavigateDown", M.down, {})
vim.api.nvim_create_user_command("ZellijNavigateLeft", M.left, {})
vim.api.nvim_create_user_command("ZellijNavigateRight", M.right, {})
vim.api.nvim_create_user_command("ZellijNavigateUpTab", M.up_tab, {})
vim.api.nvim_create_user_command("ZellijNavigateDownTab", M.down_tab, {})
vim.api.nvim_create_user_command("ZellijNavigateLeftTab", M.left_tab, {})
vim.api.nvim_create_user_command("ZellijNavigateRightTab", M.right_tab, {})
end
return M