It's become common for editors/IDEs to support custom URL file-like protocols, i.e. URL protocols that the OS will respond to by opening the file in the (correct project workspace window of the) application, and perhaps taking some extra actions such as moving the cursor to a coordinate (although this particular action is less relevant for fd). Examples are
It would be very nice if fd were to make this convenient.
1571 has made it possible to render results as terminal hyperlinks while retaining color, and displaying the relative path rather than the absolute path. However, these are currently limited to the traditional file:// protocol, which for many users will not actually open their desired application in the desired manner.
While it is currently possible to construct arbitrary hyperlink results using --format, that currently has a few drawbacks:
It would be cumbersome to get nice coloring and to have that coloring match fd's usual color behavior.
It's (AIUI) not current possibly to have the relative path displayed; the user would have to see the absolute path.
It requires users to set up a rather technical alias or shell wrapper.
This issue is proposing that fd offer new options that overcome these drawbacks. Specifically, the designed solution should satisfy the following:
Convenient to retain fd's coloring
Relative path is displayed, not absolute
User can conveniently construct URLs for popular IDEs/editors
Additionally, it would be ideal to have
User can construct URL with custom protocol, custom URL format, URL parameters
It's become common for editors/IDEs to support custom URL file-like protocols, i.e. URL protocols that the OS will respond to by opening the file in the (correct project workspace window of the) application, and perhaps taking some extra actions such as moving the cursor to a coordinate (although this particular action is less relevant for
fd
). Examples areIt would be very nice if
fd
were to make this convenient.1571 has made it possible to render results as terminal hyperlinks while retaining color, and displaying the relative path rather than the absolute path. However, these are currently limited to the traditional
file://
protocol, which for many users will not actually open their desired application in the desired manner.While it is currently possible to construct arbitrary hyperlink results using
--format
, that currently has a few drawbacks:fd
's usual color behavior.This issue is proposing that
fd
offer new options that overcome these drawbacks. Specifically, the designed solution should satisfy the following:fd
's coloringAdditionally, it would be ideal to have
It may be worth noting that a substantial amount of design work (as well as implementation in Rust) was done to address similar goals in https://github.com/BurntSushi/ripgrep/pull/2483.
For context, current workarounds that have been proposed include
(fails on color, relative paths, and inconvenience)
and
(fails on inconvenience and probably bugs such as hostnames with spaces etc)