Lilja / zellij.nvim

Zellij integration for neovim
90 stars 7 forks source link

zellij setup #3

Open ssipos90 opened 1 year ago

ssipos90 commented 1 year ago

Hi,

I'm missing something out or is any necessary zellij config that one needs to setup for this plugin to work?

I'm coming from Navigator.nvim which I set up using <C-hjkl> for navigation.

Of all the keys only works, so something is off. This is my "normal" mode in zellij:

    normal clear-defaults=true {
        bind "Ctrl a" { SwitchToMode "Tmux"; }

        bind "Ctrl h" { MoveFocus "Left"; }
        bind "Ctrl j" { MoveFocus "Down"; }
        bind "Ctrl k" { MoveFocus "Up"; }
        bind "Ctrl l" { MoveFocus "Right"; }
    }

I disabled Navigator.nvim in lazy.nvim and it shows disabled:

return {
  'numToStr/Navigator.nvim',
  lazy = false,
  enabled = vim.env.ZELLIJ == nil,
  keys = {
    { "<C-h>", '<cmd>NavigatorLeft<cr>',     { desc = "Navigator Left", mode = { "n", "t" } } },
    { "<C-l>", '<cmd>NavigatorRight<cr>',    { desc = "Navigator Right", mode = { "n", "t" } } },
    { "<C-k>", '<cmd>NavigatorUp<cr>',       { desc = "Navigator Up", mode = { "n", "t" } } },
    { "<C-j>", '<cmd>NavigatorDown<cr>',     { desc = "Navigator Down", mode = { "n", "t" } } },
    { "<C-p>", '<cmd>NavigatorPrevious<cr>', { desc = "Navigator Previous" } },
  },
  opts = {
    disable_on_zoom = true,
  }
}

and enabled zellij.nvim:

return {
  "Lilja/zellij.nvim",
  lazy = false,
  enabled = vim.env.ZELLIJ ~= nil,
  opts = {
    debug = true,
    vimTmuxNavigatorKeybinds = true,
    whichKeyEnabled = true,
  }
}

Thanks for your work!

edit: this is the output of :checkhealth zellij

zellij: require("zellij.health").check()

zellij.nvim report ~
- Using binary 'zellij'
- OK Zellij binary found and version matches expected version number
- OK zellij 0.37.2
Lilja commented 1 year ago

@ssipos90 Thanks for your issue!

Does the :ZellijNavigateLeft or :ZellijNavigateRight commands work for you?

ssipos90 commented 1 year ago

yes, they do. interesting. could it be some neovim keymap conflict?

I ran :nmap and found the key bindings somewhere in the middle:

n  <C-K>       * <Cmd>ZellijNavigateUp<CR>
                 Navigate up vim window/zellij pane
n  <C-H>       * <Cmd>ZellijNavigateLeft<CR>
                 Navigate left vim window/zellij  pane
n  <C-J>       * <Cmd>ZellijNavigateDown<CR>
                 Navigate down vim window/zellij  pane

And way below at the bottom

n  <C-L>       * <Cmd>ZellijNavigateRight<CR>
                 Navigate right vim window/zellij pane
Lilja commented 1 year ago

It potentially be something with the latest PR i accepted. I saw that lazy.nvim has branch support so if you could try the revert-2-plugin branch and then add the setup function call.

ssipos90 commented 1 year ago

nah, it seems to still be the case with that branch.

return {
  "Lilja/zellij.nvim",
  branch = "revert-2-plugin",
  lazy = false,
  enabled = vim.env.ZELLIJ ~= nil,
  config = function()
    require("zellij").setup {
      vimTmuxNavigatorKeybinds = true,
      whichKeyEnabled = true,
      debug = true
    }
  end
}

from :Lazy

   ● zellij.nvim 1.35ms  start
        dir    /home/ssipos/.local/share/nvim/lazy/zellij.nvim
        url    https://github.com/Lilja/zellij.nvim
        branch revert-2-plugin
        commit 5ad77b1
        readme README.md

Also, I noticed ctrl-j sends a new line / enter. I found an opened issue here: https://github.com/zellij-org/zellij/issues/2679

Lilja commented 1 year ago

All right, hmm.

To be honest I think this plugin works, but it might be that the experience of navigating from a pane that is not running neovim is not working. See this issue for more details https://github.com/zellij-org/zellij/issues/967