use cd for directory hyperlinks #5377
Replies: 5 comments 6 replies
-
```conf
# Change directory in shell
protocol file
mime inode/directory
action send_text normal,application cd ${FILE_PATH}\r
```
|
Beta Was this translation helpful? Give feedback.
-
Use the ssh kitten, then you can just do
edit-in-kitty file
and it will automatically and transparently open the remote file in a
local editor instance, with all the bells and whistles.
https://sw.kovidgoyal.net/kitty/shell-integration/#edit-files-in-new-kitty-windows-even-over-ssh
|
Beta Was this translation helpful? Give feedback.
-
I noticed that
It would be nice if there is a better way to be able to freely customize the open action. For example
Until this is improved, you can replace the protocol in hyperlink with a custom one and define matching rules. |
Beta Was this translation helpful? Give feedback.
-
On Sat, Aug 13, 2022 at 07:15:59PM -0700, page-down wrote:
It would be nice if there was a better way to be able to freely customize the open action. For example `remote_file` kitten should be defined in the default open action, when hostname is not empty. This way the user can override the default rule.
Doing that would break backward compatibility, since it would mean the
remote file kitten would not work for anyone that has defined their own
open actions.
The best that can be done in a backwards compat way is to define a
separate set of open actions that apply for remote URLs, but this
wouldn't solve OP's problem anyway, see below.
> ... click on a directory on the remote system ...
Once you can customize the rule that hostname is not empty, you need to check if the path is a directory on the remote system and execute cd, otherwise other commands.
There is no way to know a URL points to a file or a directory on a
remote system, so you cant really use open actions to match against
directories anyway. You would need to change the OSC 8 spec to demand
that URLs to directories end with / and then change ls and other
programs that generate these to comply with that.
|
Beta Was this translation helpful? Give feedback.
-
No currently, clicking on links in remote systems is hardcoded to use
the remote files kitten. I am saying that even if that were changed,
without changing ls to output a trailing / on links to directories your
use case is not supportable.
|
Beta Was this translation helpful? Give feedback.
-
Currently the behavior of hyperlink directories, from ls output for instance, is to open my default file manager. I'd much rather it, instead, cd to the clicked directory in my working terminal. Is there a way to do this? Currently I've set up the following in my ~/.config/kitty/open-actions.conf:
protocol file
mime inode/directory
action .....
The issue is that I don't know what to do for the action there. I've tried a few different launch actions, send-text, etc. Nothing will do what I'm hoping to accomplish so far. They all pretty much seem to just do nothing.
Was hoping someone in the community may have already worked this one out. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions