summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-26 00:21:38 +0300
committerPaul Buetow <paul@buetow.org>2025-06-26 00:21:38 +0300
commitf66b8ee57631597acc46739dd4735b0eae45a2ed (patch)
tree71d0e91caa94392637622762c7776200f71211f4 /README.md
parentbfd44998d3ab14e5f240dad6a52dd89a94659fbc (diff)
fix fish shell integration
Diffstat (limited to 'README.md')
-rw-r--r--README.md33
1 files changed, 29 insertions, 4 deletions
diff --git a/README.md b/README.md
index 6d92f9f..ce30d1b 100644
--- a/README.md
+++ b/README.md
@@ -36,13 +36,38 @@ sudo mv timr /usr/local/bin/
### Installation
-1. Copy the `integrations/fish-shell` directory to your fish plugins directory:
+Add this to your fish config:
- ```bash
- cp -r integrations/fish-shell ~/.config/fish/plugins/timr
+ ```fish
+ function timr_prompt -d "Display timr timr_status in the prompt"
+ if command -v timr >/dev/null
+ set -l timr_status (timr prompt)
+ if test -n "$timr_status"
+ set -l icon (string sub -l 1 -- "$timr_status")
+ set -l time (string sub -s 2 -- "$timr_status")
+ if test "$icon" = "▶"
+ set_color green
+ else
+ set_color yellow
+ end
+ printf '%s' "$icon"
+ set_color normal
+ printf ' %s' "$time"
+ end
+ end
+ end
+
+ complete -c timr -n __fish_use_subcommand -a start -d "Start the timer"
+ complete -c timr -n __fish_use_subcommand -a stop -d "Stop the timer"
+ complete -c timr -n __fish_use_subcommand -a pause -d "Pause the timer"
+ complete -c timr -n __fish_use_subcommand -a status -d "Show the timer status"
+ complete -c timr -n __fish_use_subcommand -a reset -d "Reset the timer"
+ complete -c timr -n __fish_use_subcommand -a live -d "Show the live timer"
+ complete -c timr -n __fish_use_subcommand -a prompt -d "Show the prompt status"
```
-2. Update your `fish_prompt` or `fish_right_prompt` function to include the `timr_prompt` function. For example, you can add the following to your `~/.config/fish/functions/fish_prompt.fish` file:
+
+2. Update your `fish_prompt` or `fish_right_prompt` function to include the `timr_prompt` function:
```fish
function fish_prompt