mrjones2014 / smart-splits.nvim

🧠 Smart, seamless, directional navigation and resizing of Neovim + terminal multiplexer splits. Supports tmux, Wezterm, and Kitty. Think about splits in terms of "up/down/left/right".
MIT License
977 stars 43 forks source link

feat: Kitty multiplexer backend support #50

Closed mrjones2014 closed 1 year ago

mrjones2014 commented 1 year ago

Fixes: #49

mrjones2014 commented 1 year ago

@primeapple Please give this a test.

mehalter commented 1 year ago

@mrjones2014 thanks for this! I gave it a shot and get this error when trying to switch to a split in kitty. I can switch between my neovim splits just fine

2023-04-03T13:47:20  ERROR [smart-splits.nvim] Failed to get multiplexer pane ID  
mrjones2014 commented 1 year ago

@mehalter what Kitty version are you using and did you set it up to allow remote commands? https://github.com/mrjones2014/smart-splits.nvim/pull/50/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R334

I can't reproduce your issue.

mehalter commented 1 year ago

Yeah I am, I am actually trying to move directly from https://github.com/knubie/vim-kitty-navigator

mrjones2014 commented 1 year ago

can you paste the output (removing anything sensitive, if there is anything) of kitty @ ls when you have multiple kitty splits open?

mehalter commented 1 year ago

This is with a single vertical split:

[
  {
    "id": 1,
    "is_active": true,
    "is_focused": true,
    "last_focused": true,
    "platform_window_id": 92274702,
    "tabs": [
      {
        "active_window_history": [
          1,
          2
        ],
        "enabled_layouts": [
          "splits:split_axis=horizontal"
        ],
        "id": 1,
        "is_active": true,
        "is_focused": true,
        "layout": "splits",
        "layout_opts": {
          "default_axis_is_horizontal": true
        },
        "layout_state": {
          "pairs": {
            "bias": 0.5,
            "horizontal": true,
            "one": 1,
            "two": 2
          }
        },
        "title": "kitty @ ls",
        "windows": [
          {
            "cmdline": [
              "/bin/zsh"
            ],
            "columns": 43,
            "cwd": "/home/micah",
            "env": {
              "KITTY_WINDOW_ID": "1"
            },
            "foreground_processes": [
              {
                "cmdline": [
                  "kitty",
                  "@",
                  "ls"
                ],
                "cwd": "/home/micah",
                "pid": 951868
              }
            ],
            "id": 1,
            "is_active": true,
            "is_focused": true,
            "is_self": true,
            "lines": 68,
            "pid": 951508,
            "title": "kitty @ ls"
          },
          {
            "cmdline": [
              "/bin/zsh"
            ],
            "columns": 43,
            "cwd": "/home/micah",
            "env": {
              "KITTY_WINDOW_ID": "2"
            },
            "foreground_processes": [
              {
                "cmdline": [
                  "/bin/zsh"
                ],
                "cwd": "/home/micah",
                "pid": 951621
              }
            ],
            "id": 2,
            "is_active": false,
            "is_focused": false,
            "is_self": false,
            "lines": 68,
            "pid": 951621,
            "title": "~"
          }
        ]
      }
    ],
    "wm_class": "kitty",
    "wm_name": "kitty"
  }
]
mrjones2014 commented 1 year ago

Ah, probably a difference in Kitty version then. My code is currently looking for tab.is_active_tab but your output shows just tab.is_active. I'll update to check for both so it works for both Kitty versions.

mehalter commented 1 year ago

Ah yeah that makes sense, I am using kitty 0.27.1 created by Kovid Goyal I believe this is the latest version

mrjones2014 commented 1 year ago

@mehalter please give it another shot if you don't mind, thanks 🙂

mehalter commented 1 year ago

Dang, I hate to be a nuisance here LOL but I'm getting the same error :(

mrjones2014 commented 1 year ago

Dang, I hate to be a nuisance here LOL but I'm getting the same error :(

Not a nuisance at all, I want to get it working 🙂

I updated my Kitty version and can reproduce now, so it should be easier to debug on my end.

mrjones2014 commented 1 year ago

@mehalter I had a typo -- try one more time please?

mehalter commented 1 year ago

Works perfectly! Thanks @mrjones2014 !

primeapple commented 1 year ago

Holy guacamole. This was fast.

Will try it in the following days. You might shorten the copied Readme a bit ;-)

Btw: When using the split layout ( https://sw.kovidgoyal.net/kitty/layouts/#the-splits-layout ) in Kitty, it should be possible to work out resizing and paneswapping ;-)

mrjones2014 commented 1 year ago

Btw: When using the split layout ( https://sw.kovidgoyal.net/kitty/layouts/#the-splits-layout ) in Kitty, it should be possible to work out resizing and paneswapping ;-)

As mentioned here: https://sw.kovidgoyal.net/kitty/layouts/#window-resizing

The window resizing API in Kitty is not directional, it's "taller"/"shorter"/"wider"/"narrower" so directional resizing won't work.

osleg commented 1 year ago

kitty/active_pane.py file is listed in install script but missing from the PR

mrjones2014 commented 1 year ago

Thanks for calling that out -- I've removed that line from the install script.