jpalardy / vim-slime

A vim plugin to give you some slime. (Emacs)
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/
MIT License
1.87k stars 227 forks source link

Inaccurate documentation on kitty #350

Open newptcai opened 1 year ago

newptcai commented 1 year ago

The ReadMe says

To work properly, kitty must also be started with the following options:

kitty -o allow_remote_control=yes --listen-on unix:/tmp/mykitty

See more here. This can also be added to your kitty.conf file as:

allow_remote_control yes
listen_on unix:/tmp/mykitty

This is inaccurate. Putting listen_on unix:/tmp/mykitty will make each kitty instance listen to unix:/tmp/mykitty{kitty_pid}, where {kitty_pid} is the PID of the kitty process.

So to make slime work, you have to launch kitty from command line, or to use the method.

jpalardy commented 1 year ago

Hi @newptcai

I don't use kitty myself, so I don't know if this changed. 🤔

Would you be willing to open a documentation PR for this?

cc @mdzhang @xiangpeng2008

mdzhang commented 1 year ago

can confirm i can use vim + kitty + slime w/o listen_on unix:/tmp/mykitty

kitty 0.26.3 macos 12.6 monterey vim 9.0.0700

newptcai commented 1 year ago

can confirm i can use vim + kitty + slime w/o listen_on unix:/tmp/mykitty

kitty 0.26.3 macos 12.6 monterey vim 9.0.0700

If you run kitty and vim in the same os_window, then the environment variable KITTY_LISTEN_ON will be set correctly. You just need to provide the correct window ID.

jpalardy commented 1 year ago

Hi there,

This has been opened for a few weeks ^

Can someone open a PR with their recommended/udpated kitty config?

newptcai commented 1 year ago

I think I explained things reasonably clear in Readme in my PR.

SanteriHei commented 1 year ago

The ReadMe says

To work properly, kitty must also be started with the following options:

kitty -o allow_remote_control=yes --listen-on unix:/tmp/mykitty

See more here. This can also be added to your kitty.conf file as:

allow_remote_control yes
listen_on unix:/tmp/mykitty

This is inaccurate. Putting listen_on unix:/tmp/mykitty will make each kitty instance listen to unix:/tmp/mykitty{kitty_pid}, where {kitty_pid} is the PID of the kitty process.

So to make slime work, you have to launch kitty from command line, or to use the method.

You can actually make it work quite easily with a few lines in your .vimrc/init.lua. I currently have the following lines in my init.lua file that assigns the correct default value for vim-slime by extracting the pid of kitty process. However, this breaks if one has multiple kitty instances running at the same time.

-- NOTE: Assumes that kitty.conf has parameter 
-- 'listen_on' set to unix:/tmp/mykitty
-- In this case, kitty will append the pid of kitty to the end of the path
-- Thus we check the pid of the kitty instance, and use that as the 
--
local pid = vim.fn.system("pgrep kitty")
pid = pid:gsub("[\n\r]","") 
local listen_on = string.format("unix:/tmp/mykitty-%s", pid)
vim.g.slime_default_config = {['listen_on']=listen_on, ['window_id']=2}
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.