Open slai-nick opened 2 weeks ago
Hi,
Thanks for using the plugin! I'm glad to hear that you're enjoying the integration.
That's a good idea. Unfortunately, I'm currently pretty busy and won't be able to take a look at this for another three weeks. However, if you want to give it a try yourself, here are some pointers on how to solve the problem:
Install Kitty on the Remote Machine: Ensure that Kitty is installed on the remote machine. You can use the following commands to install Kitty using Linux brew:
wget https://github.com/kovidgoyal/kitty/releases/download/v0.20.3/kitty-0.20.3-x86_64.txz -O kitty.txz
mkdir $HOMEBREW_PREFIX/Cellar/kitty
tar xf kitty.txz -C $HOMEBREW_PREFIX/Cellar/kitty
ln -sf $HOMEBREW_PREFIX/Cellar/kitty/bin/kitty $HOMEBREW_PREFIX/bin
rm kitty.txz
Enable Remote Control in Kitty:
Configure Kitty to allow remote control by adding the following lines to the ~/.config/kitty/kitty.conf
file on both local and remote machines:
allow_remote_control yes
listen_on unix:/tmp/mykitty
Alternatively, you can start Kitty with the following command:
kitty -o allow_remote_control=yes --listen-on unix:/tmp/mykitty
Set Up SSH Port Forwarding: To forward the Kitty remote control socket over SSH, use the following command when connecting to the remote machine:
ssh -R 50000:${KITTY_LISTEN_ON#*:} user@host
You can also add an alias to your shell configuration file (e.g., .zshrc
or .bashrc
) to simplify this step:
alias ssh='ssh -R 50000:${KITTY_LISTEN_ON#*:}'
Configure Environment Variables:
On the remote machine, add the following snippet to your shell configuration file (e.g., .zshrc
):
if [[ $SSH_TTY ]] && ! [ -n "$TMUX" ]; then
export KITTY_PORT=$(kitty @ ls 2>/dev/null | grep "[0-9]:/tmp/mykitty" | head -n 1 | cut -d : -f 1 | cut -d \" -f 2)
fi
Update Kitty Navigator Configuration:
Ensure that the key bindings for navigating between Kitty windows and Neovim splits are correctly set in the ~/.config/kitty/kitty.conf
file:
map ctrl+j kitten pass_keys.py neighboring_window bottom ctrl+j
map ctrl+k kitten pass_keys.py neighboring_window top ctrl+k
map ctrl+h kitten pass_keys.py neighboring_window left ctrl+h
map ctrl+l kitten pass_keys.py neighboring_window right ctrl+l
Install and Configure the Plugin:
Ensure that the munsman/kitty-navigator.nvim
plugin is installed and configured in Neovim. You can use a package manager like Lazy.nvim:
require("lazy").setup({
"MunsMan/kitty-navigator.nvim",
build = {
"cp navigate_kitty.py ~/.config/kitty",
"cp pass_keys.py ~/.config/kitty",
},
opts = {
keybindings = {
left = "<C-h>",
down = "<C-j>",
up = "<C-k>",
right = "<C-l>",
},
},
})
Test the Configuration: Restart Kitty and Neovim, and test the navigation to ensure that the key bindings work seamlessly both locally and over SSH.
You are welcome to give it a try and let me know if you run into any issues. I'll be able to take a closer look in a few weeks.
Hi, thanks for the plugin I am really enjoying the integration.
I have one request, and I don't know if that is possible, but it would be great if kitty-navigator would work in a ssh session.
Currently it forces me to handle different configurations or shortcuts when I am working remote as changing vim window ends up changing kitty window.