From 9de714a8a93f9c353abf5979f74b676fe6397b04 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 26 May 2021 12:32:34 -0400 Subject: Improve documentation of hyperlinks (#616) --- README.md | 2 ++ src/cli.rs | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9ff487d4..d0b9db6b 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ Code evolves, and we all spend time studying diffs. Delta aims to make this both - Support for Git's `--color-moved` feature. - Code can be copied directly from the diff (`-/+` markers are removed by default). - `n` and `N` keybindings to move between files in large diffs, and between diffs in `log -p` views (`--navigate`) +- Commit hashes can be formatted as terminal [hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) to the Github/GitLab/Bitbucket page (`--hyperlinks`). + File paths can also be formatted as hyperlinks for opening in your OS. The most convenient way to configure delta is with a `[delta]` section in `~/.gitconfig`. Here's a quick example: diff --git a/src/cli.rs b/src/cli.rs index 8a8c162f..d9873d3c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -237,15 +237,17 @@ pub struct Opt { pub relative_paths: bool, #[structopt(long = "hyperlinks")] - /// Render commit hashes, file names, and line numbers as hyperlinks, according to the - /// hyperlink spec for terminal emulators: - /// https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. By default, file names - /// and line numbers link to the local file using a file URL, whereas commit hashes link to the - /// commit in GitHub, if the remote repository is hosted by GitHub. See - /// --hyperlinks-file-link-format for full control over the file URLs emitted. Hyperlinks are - /// supported by several common terminal emulators. To make them work, you must pass the -r (as - /// opposed to -R) flag to less, e.g. via `export DELTA_PAGER=less -rX`. If you use tmux, then - /// you will also need a patched fork of tmux (see https://github.com/dandavison/tmux). + /// Render commit hashes, file names, and line numbers as hyperlinks, + /// according to the hyperlink spec for terminal emulators: + /// https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. By + /// default, file names and line numbers link to the local file using a file + /// URL, whereas commit hashes link to the commit in GitHub, if the remote + /// repository is hosted by GitHub. See --hyperlinks-file-link-format for + /// full control over the file URLs emitted. Hyperlinks are supported by + /// several common terminal emulators. To make them work, you must use less + /// version >= 581 with the -R flag (or use -r with older less versions, but + /// this will break e.g. --navigate). If you use tmux, then you will also + /// need a patched fork of tmux (see https://github.com/dandavison/tmux). pub hyperlinks: bool, #[structopt(long = "keep-plus-minus-markers")] -- cgit v1.2.3