summaryrefslogtreecommitdiff
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
parentbfd44998d3ab14e5f240dad6a52dd89a94659fbc (diff)
fix fish shell integration
-rw-r--r--README.md33
-rw-r--r--integrations/fish-shell/completions/timr.fish7
-rw-r--r--integrations/fish-shell/functions/timr_prompt.fish17
3 files changed, 29 insertions, 28 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
diff --git a/integrations/fish-shell/completions/timr.fish b/integrations/fish-shell/completions/timr.fish
deleted file mode 100644
index b71ad60..0000000
--- a/integrations/fish-shell/completions/timr.fish
+++ /dev/null
@@ -1,7 +0,0 @@
-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"
diff --git a/integrations/fish-shell/functions/timr_prompt.fish b/integrations/fish-shell/functions/timr_prompt.fish
deleted file mode 100644
index 774861c..0000000
--- a/integrations/fish-shell/functions/timr_prompt.fish
+++ /dev/null
@@ -1,17 +0,0 @@
-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