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
831 stars 33 forks source link

fix: use kitty user-vars for for determining if active window is running neovim #175

Closed oddnugget closed 3 months ago

oddnugget commented 4 months ago

Attempts fixing: #147

I'm not well versed in Python, but i have this working in my setup so i thought i would contribute. Not sure about the best place to call the user-var kitten on the nvim side.

kovidgoyal commented 4 months ago

Note that you dont need to use remote control, or indeed even a kitten for this. You can use the new-ish conditional mappings feature in kitty. https://sw.kovidgoyal.net/kitty/mapping/#conditional-mappings-depending-on-the-state-of-the-focused-window

That shows you how to configure vim and neovim to set a user var in kitty when they are active.

oddnugget commented 4 months ago

Oh wow! That was actually a lot smoother. Thanks! I must have missed it in the documentation. I'll try and update the PR when i get some time

mrjones2014 commented 4 months ago

Note that if we update to remove the pass_keys.py kitten in favor of the new conditional mappings in Kitty, we will also need to remove this line from kitty/install_kittens.bash

https://github.com/mrjones2014/smart-splits.nvim/blob/50f52146e4504a3fc0f0d5830c8560a16a95dd08/kitty/install-kittens.bash#L5

oddnugget commented 4 months ago

Note that if we update to remove the pass_keys.py kitten in favor of the new conditional mappings in Kitty, we will also need to remove this line from kitty/install_kittens.bash

https://github.com/mrjones2014/smart-splits.nvim/blob/50f52146e4504a3fc0f0d5830c8560a16a95dd08/kitty/install-kittens.bash#L5

it seems relative_resize_window is duplicated between pass-keys.py and relative-resize.py. Should i go ahead and delete pass-keys altogether?

mrjones2014 commented 3 months ago

it seems relative_resize_window is duplicated between pass-keys.py and relative-resize.py. Should i go ahead and delete pass-keys altogether?

@oddnugget so sorry this totally fell off my radar, apologies! Yeah, if I understand correctly, using Kitty user vars means we don't needs pass_keys.py anymore, since all that did was determine whether to consume the keys at the Kitty level or to pass them on to Neovim, which is now handled by Kitty conditional mappings.

mrjones2014 commented 3 months ago

You can go ahead and delete the pass_keys.py file outright, then just update the install_kittens.bash script to remove the now-obsolete lines.

oddnugget commented 3 months ago

Totally forgot about this one. Will have a look later today

oddnugget commented 3 months ago

Update the README. I haven't tested the relative resizing, don't use that feature, but it should work the same way i presume.

oddnugget commented 3 months ago

Happy to help :)