Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hints kitten: selected path not opened in current window #5462

Closed
tim-hilt opened this issue Sep 2, 2022 · 6 comments
Closed

hints kitten: selected path not opened in current window #5462

tim-hilt opened this issue Sep 2, 2022 · 6 comments

Comments

@tim-hilt
Copy link

tim-hilt commented Sep 2, 2022

Is your feature request related to a problem? Please describe.

I tried using this keybinding:

map kitty_mod+e kitten hints --type path --program nvim

but then I realized, that --program expects a new window to be opened!

Describe the solution you'd like

Reusing the current kitty-window to open the selected hint in Neovim

Describe alternatives you've considered

I still got the selected file to be opened in Neovim with:

map kitty_mod+e kitten hints --type path --program "kitty nvim"

which is almost there and I'll use this, if no other option is present.

Additional context

λ kitty --version
kitty 0.26.1 created by Kovid Goyal
@kovidgoyal
Copy link
Owner

The current kitty window is already used by something, presumably a
shell. If you mean you want to open a new overlay/tab/os-window
you can use the kitty remote control feature
https://sw.kovidgoyal.net/kitty/remote-control/

Have kitty listen on a socket for commands and have the program be
a script that runs

kitty @ launch --type=overlay nvim

Alternately, use https://sw.kovidgoyal.net/kitty/kittens/hints/#completely-customizing-the-matching-and-actions-of-the-kitten

and you can just do

boss.new_window_with_cwd(['nvim'] + args)

@tim-hilt
Copy link
Author

tim-hilt commented Sep 2, 2022

Thank you for the quick reply and explanation! The more I use kitty, the more I learn that I don't know everything it can do. Thanks for your amazing work! Kitty continues to make me smile whenever I use it to make stuff easier once again. 🙂

@tim-hilt
Copy link
Author

tim-hilt commented Sep 2, 2022

Ok, it seems that I have to investigate a bit further. Running

kitty @ launch --type=overlay nvim

standalone opens up nvim in the current window, but it doesn't do anything, if I provide it for the --program-argument to the hints-kitten. It also makes no difference, when I put it inside a script.

@kovidgoyal
Copy link
Owner

you need to write a wrapper script for program. And in it do something
like

exec kitty @ --to=unix:whatever launch nvim "$@"

though I will make a change for the next release that will make the --to
above unnecessary.

@page-down
Copy link
Contributor

page-down commented Sep 2, 2022

... it doesn't do anything ...

This means that the --program in hints kitten should be configured to execute the script with this code, and obviously this is just the example for inspiration, you also need to provide nvim with the arguments from hints kitten (i.e. the path to the file you want to open).

I would suggest adding an option like --window-type for hints kitten --program.

You need to know that programs run directly by kitty are not the same as run by a shell, especially with environment variables, and there are some differences in the functionality of overlay compared to regular kitty windows.

@kovidgoyal kovidgoyal reopened this Sep 2, 2022
@tim-hilt
Copy link
Author

tim-hilt commented Sep 2, 2022

@kovidgoyal I installed kitty from master and now the following achieves exactly what I was thinking off:

map kitty_mod+e kitten hints --type path --program "launch --type=overlay nvim"

thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants