summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2023-07-05 17:05:39 -0300
committerRoger Gonzalez <roger@rogs.me>2023-07-05 17:05:39 -0300
commit3913586f678437d6de80bc96c8eea0e1e69a51ac (patch)
tree1d15289894a456229dc7416863b1ad530f467c43
parentac3630acff3a49da55913f4e66d0af4aacdebec8 (diff)
Updated tide
-rw-r--r--.config/fish/fish_plugins6
-rw-r--r--.config/fish/functions/_tide_item_cmd_duration.fish15
-rw-r--r--.config/fish/functions/_tide_item_context.fish12
-rw-r--r--.config/fish/functions/_tide_item_crystal.fish4
-rw-r--r--.config/fish/functions/_tide_item_git.fish4
-rw-r--r--.config/fish/functions/_tide_item_go.fish3
-rw-r--r--.config/fish/functions/_tide_item_java.fish3
-rw-r--r--.config/fish/functions/_tide_item_node.fish3
-rw-r--r--.config/fish/functions/_tide_item_php.fish3
-rw-r--r--.config/fish/functions/_tide_item_rustc.fish3
-rw-r--r--.config/fish/functions/_tide_item_terraform.fish2
-rw-r--r--.config/fish/functions/_tide_parent_dirs.fish7
-rw-r--r--.config/fish/functions/_tide_pwd.fish4
-rw-r--r--.config/fish/functions/_tide_remove_unusable_items.fish2
-rw-r--r--.config/fish/functions/fish_prompt.fish7
-rw-r--r--.config/fish/functions/tide.fish2
-rw-r--r--.config/fish/functions/tide/configure/configs/classic.fish6
-rw-r--r--.config/fish/functions/tide/configure/configs/classic_16color.fish2
-rw-r--r--.config/fish/functions/tide/configure/configs/lean.fish6
-rw-r--r--.config/fish/functions/tide/configure/configs/lean_16color.fish2
-rw-r--r--.config/fish/functions/tide/configure/configs/rainbow.fish6
-rw-r--r--.config/fish/functions/tide/configure/configs/rainbow_16color.fish2
22 files changed, 71 insertions, 33 deletions
diff --git a/.config/fish/fish_plugins b/.config/fish/fish_plugins
index cecb4a0d..b2d5f770 100644
--- a/.config/fish/fish_plugins
+++ b/.config/fish/fish_plugins
@@ -1,7 +1 @@
-jorgebucaran/fisher
ilancosman/tide@v5
-patrickf1/fzf.fish
-jorgebucaran/spark.fish
-gazorby/fish-abbreviation-tips
-oakninja/makemefish
-halostatue/fish-docker@v1.x
diff --git a/.config/fish/functions/_tide_item_cmd_duration.fish b/.config/fish/functions/_tide_item_cmd_duration.fish
index f7b9db61..bc48bac4 100644
--- a/.config/fish/functions/_tide_item_cmd_duration.fish
+++ b/.config/fish/functions/_tide_item_cmd_duration.fish
@@ -1,11 +1,12 @@
function _tide_item_cmd_duration
- test $CMD_DURATION -gt $tide_cmd_duration_threshold && time=(math --scale=0 "$CMD_DURATION/3600000" # Hours
- math --scale=0 "$CMD_DURATION/60000"%60 # Minutes
- math --scale=$tide_cmd_duration_decimals "$CMD_DURATION/1000"%60) if test $time[1] != 0
- _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$time[1]h $time[2]m $time[3]s"
- else if test $time[2] != 0
- _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$time[2]m $time[3]s"
+ test $CMD_DURATION -gt $tide_cmd_duration_threshold && t=(
+ math -s0 "$CMD_DURATION/3600000" # Hours
+ math -s0 "$CMD_DURATION/60000"%60 # Minutes
+ math -s$tide_cmd_duration_decimals "$CMD_DURATION/1000"%60) if test $t[1] != 0
+ _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[1]h $t[2]m $t[3]s"
+ else if test $t[2] != 0
+ _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[2]m $t[3]s"
else
- _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$time[3]s"
+ _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[3]s"
end
end
diff --git a/.config/fish/functions/_tide_item_context.fish b/.config/fish/functions/_tide_item_context.fish
index 9dfa56d7..575c438c 100644
--- a/.config/fish/functions/_tide_item_context.fish
+++ b/.config/fish/functions/_tide_item_context.fish
@@ -1,9 +1,15 @@
function _tide_item_context
if set -q SSH_TTY
- tide_context_color=$tide_context_color_ssh _tide_print_item context $USER@$hostname
+ set -lx tide_context_color $tide_context_color_ssh
+ test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER ||
+ h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts])
else if test "$EUID" = 0
- tide_context_color=$tide_context_color_root _tide_print_item context $USER@$hostname
+ set -lx tide_context_color $tide_context_color_root
+ test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER ||
+ h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts])
else if test "$tide_context_always_display" = true
- tide_context_color=$tide_context_color_default _tide_print_item context $USER@$hostname
+ set -lx tide_context_color $tide_context_color_default
+ test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER ||
+ h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts])
end
end
diff --git a/.config/fish/functions/_tide_item_crystal.fish b/.config/fish/functions/_tide_item_crystal.fish
new file mode 100644
index 00000000..cec97520
--- /dev/null
+++ b/.config/fish/functions/_tide_item_crystal.fish
@@ -0,0 +1,4 @@
+function _tide_item_crystal
+ path is $_tide_parent_dirs/shard.yml &&
+ _tide_print_item crystal $tide_crystal_icon' ' (crystal --version | string match -r "[\d.]+")[1]
+end
diff --git a/.config/fish/functions/_tide_item_git.fish b/.config/fish/functions/_tide_item_git.fish
index 9fca6d0e..43d46cb1 100644
--- a/.config/fish/functions/_tide_item_git.fish
+++ b/.config/fish/functions/_tide_item_git.fish
@@ -1,10 +1,10 @@
function _tide_item_git
- if git branch --show-current 2>/dev/null | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read -l location
+ if git branch --show-current 2>/dev/null | string replace -r ".+(.{$tide_git_truncation_length})" '…$1' | read -l location
git rev-parse --git-dir --is-inside-git-dir | read -fL gdir in_gdir
set location $_tide_location_color$location
else if test $pipestatus[1] != 0
return
- else if git tag --points-at HEAD | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read location
+ else if git tag --points-at HEAD | string replace -r ".+(.{$tide_git_truncation_length})" '…$1' | read location
git rev-parse --git-dir --is-inside-git-dir | read -fL gdir in_gdir
set location '#'$_tide_location_color$location
else
diff --git a/.config/fish/functions/_tide_item_go.fish b/.config/fish/functions/_tide_item_go.fish
index 304acc52..7c5919f8 100644
--- a/.config/fish/functions/_tide_item_go.fish
+++ b/.config/fish/functions/_tide_item_go.fish
@@ -1,3 +1,4 @@
function _tide_item_go
- test -e go.mod && _tide_print_item go $tide_go_icon' ' (go version | string match -r "[\d.]+")
+ path is $_tide_parent_dirs/go.mod &&
+ _tide_print_item go $tide_go_icon' ' (go version | string match -r "[\d.]+")
end
diff --git a/.config/fish/functions/_tide_item_java.fish b/.config/fish/functions/_tide_item_java.fish
index 88d0ea6e..6105acc7 100644
--- a/.config/fish/functions/_tide_item_java.fish
+++ b/.config/fish/functions/_tide_item_java.fish
@@ -1,3 +1,4 @@
function _tide_item_java
- test -e pom.xml && _tide_print_item java $tide_java_icon' ' (java -version &| string match -r "[\d.]+")[1]
+ path is $_tide_parent_dirs/pom.xml &&
+ _tide_print_item java $tide_java_icon' ' (java -version &| string match -r "[\d.]+")[1]
end
diff --git a/.config/fish/functions/_tide_item_node.fish b/.config/fish/functions/_tide_item_node.fish
index 90a929b0..05880510 100644
--- a/.config/fish/functions/_tide_item_node.fish
+++ b/.config/fish/functions/_tide_item_node.fish
@@ -1,3 +1,4 @@
function _tide_item_node
- test -e package.json && _tide_print_item node $tide_node_icon' ' (node --version | string trim --chars=v)
+ path is $_tide_parent_dirs/package.json &&
+ _tide_print_item node $tide_node_icon' ' (node --version | string trim --chars=v)
end
diff --git a/.config/fish/functions/_tide_item_php.fish b/.config/fish/functions/_tide_item_php.fish
index 64fc59b6..abc104e0 100644
--- a/.config/fish/functions/_tide_item_php.fish
+++ b/.config/fish/functions/_tide_item_php.fish
@@ -1,3 +1,4 @@
function _tide_item_php
- test -e composer.json && _tide_print_item php $tide_php_icon' ' (php --version | string match -r 'PHP ([\d.]+)')[2]
+ path is $_tide_parent_dirs/composer.json &&
+ _tide_print_item php $tide_php_icon' ' (php --version | string match -r 'PHP ([\d.]+)')[2]
end
diff --git a/.config/fish/functions/_tide_item_rustc.fish b/.config/fish/functions/_tide_item_rustc.fish
index b898e6f3..2e71645e 100644
--- a/.config/fish/functions/_tide_item_rustc.fish
+++ b/.config/fish/functions/_tide_item_rustc.fish
@@ -1,3 +1,4 @@
function _tide_item_rustc
- test -e Cargo.toml && _tide_print_item rustc $tide_rustc_icon' ' (rustc --version | string split ' ')[2]
+ path is $_tide_parent_dirs/Cargo.toml &&
+ _tide_print_item rustc $tide_rustc_icon' ' (rustc --version | string split ' ')[2]
end
diff --git a/.config/fish/functions/_tide_item_terraform.fish b/.config/fish/functions/_tide_item_terraform.fish
index 60fd3fb1..8d99fb77 100644
--- a/.config/fish/functions/_tide_item_terraform.fish
+++ b/.config/fish/functions/_tide_item_terraform.fish
@@ -1,5 +1,5 @@
function _tide_item_terraform
- if test -d .terraform
+ if path is $_tide_parent_dirs/.terraform
terraform workspace show | read -l workspace
test $workspace != default && _tide_print_item terraform $tide_terraform_icon' ' $workspace
end
diff --git a/.config/fish/functions/_tide_parent_dirs.fish b/.config/fish/functions/_tide_parent_dirs.fish
new file mode 100644
index 00000000..9f31b043
--- /dev/null
+++ b/.config/fish/functions/_tide_parent_dirs.fish
@@ -0,0 +1,7 @@
+function _tide_parent_dirs --on-variable PWD
+ set -g _tide_parent_dirs (string escape (
+ for dir in (string split / -- $PWD)
+ set -la parts $dir
+ string join / -- $parts
+ end))
+end
diff --git a/.config/fish/functions/_tide_pwd.fish b/.config/fish/functions/_tide_pwd.fish
index 1680528e..3bd53b0f 100644
--- a/.config/fish/functions/_tide_pwd.fish
+++ b/.config/fish/functions/_tide_pwd.fish
@@ -7,7 +7,7 @@ set -l home_icon $tide_pwd_icon_home' '
set -l pwd_icon $tide_pwd_icon' '
eval "function _tide_pwd
- if set -l split_pwd (string replace -r '^$HOME' '~' \$PWD | string split /)
+ if set -l split_pwd (string replace -r '^$HOME' '~' -- \$PWD | string split /)
test -w . && set -f split_output \"$pwd_icon\$split_pwd[1]\" \$split_pwd[2..] ||
set -f split_output \"$unwritable_icon\$split_pwd[1]\" \$split_pwd[2..]
set split_output[-1] \"$color_anchors\$split_output[-1]$reset_to_color_dirs\"
@@ -15,7 +15,7 @@ eval "function _tide_pwd
set -f split_output \"$home_icon$color_anchors~\"
end
- string join / \$split_output | string length -V | read -g _tide_pwd_len
+ string join / -- \$split_output | string length -V | read -g _tide_pwd_len
i=1 for dir_section in \$split_pwd[2..-2]
string join -- / \$split_pwd[..\$i] | string replace '~' $HOME | read -l parent_dir # Uses i before increment
diff --git a/.config/fish/functions/_tide_remove_unusable_items.fish b/.config/fish/functions/_tide_remove_unusable_items.fish
index 69065dc8..f1111cba 100644
--- a/.config/fish/functions/_tide_remove_unusable_items.fish
+++ b/.config/fish/functions/_tide_remove_unusable_items.fish
@@ -1,7 +1,7 @@
function _tide_remove_unusable_items
# Remove tool-specific items for tools the machine doesn't have installed
set -l removed_items
- for item in aws chruby docker git go java kubectl nix_shell node php rustc terraform toolbox virtual_env
+ for item in aws chruby crystal docker git go java kubectl nix_shell node php rustc terraform toolbox virtual_env
set -l cli_names $item
switch $item
case virtual_env
diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish
index 7aef1678..3e820c46 100644
--- a/.config/fish/functions/fish_prompt.fish
+++ b/.config/fish/functions/fish_prompt.fish
@@ -4,6 +4,7 @@ status is-interactive || exit
_tide_remove_unusable_items
_tide_cache_variables
+_tide_parent_dirs
source (functions --details _tide_pwd)
set -l prompt_var _tide_prompt_$fish_pid
@@ -38,7 +39,8 @@ function fish_prompt
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs -q && set -lx _tide_jobs
$fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
-CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_2_line_prompt)\" &
+set _tide_parent_dirs \$_tide_parent_dirs
+PATH=\$(string escape \"\$PATH\") CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_2_line_prompt)\" &
builtin disown
command kill \$_tide_last_pid 2>/dev/null
@@ -66,7 +68,8 @@ function fish_prompt
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs -q && set -lx _tide_jobs
$fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
-CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_1_line_prompt)\" &
+set _tide_parent_dirs \$_tide_parent_dirs
+PATH=\$(string escape \"\$PATH\") CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_tide_1_line_prompt)\" &
builtin disown
command kill \$_tide_last_pid 2>/dev/null
diff --git a/.config/fish/functions/tide.fish b/.config/fish/functions/tide.fish
index 87fb8dc4..1a58f404 100644
--- a/.config/fish/functions/tide.fish
+++ b/.config/fish/functions/tide.fish
@@ -2,7 +2,7 @@ function tide --description 'Manage your Tide prompt'
argparse --stop-nonopt v/version h/help -- $argv
if set -q _flag_version
- echo 'tide, version 5.4.0'
+ echo 'tide, version 5.5.1'
else if set -q _flag_help
_tide_help
else if functions --query _tide_sub_$argv[1]
diff --git a/.config/fish/functions/tide/configure/configs/classic.fish b/.config/fish/functions/tide/configure/configs/classic.fish
index be106d85..9b23f373 100644
--- a/.config/fish/functions/tide/configure/configs/classic.fish
+++ b/.config/fish/functions/tide/configure/configs/classic.fish
@@ -20,6 +20,10 @@ tide_context_bg_color 444444
tide_context_color_default D7AF87
tide_context_color_root $_tide_color_gold
tide_context_color_ssh D7AF87
+tide_context_hostname_parts 1
+tide_crystal_bg_color 444444
+tide_crystal_color FFFFFF
+tide_crystal_icon ⬢
tide_docker_bg_color 444444
tide_docker_color 2496ED
tide_docker_default_contexts default colima
@@ -85,7 +89,7 @@ tide_pwd_icon_home
tide_pwd_icon_unwritable 
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled true
-tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell
+tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell crystal
tide_right_prompt_prefix 
tide_right_prompt_separator_diff_color 
tide_right_prompt_separator_same_color 
diff --git a/.config/fish/functions/tide/configure/configs/classic_16color.fish b/.config/fish/functions/tide/configure/configs/classic_16color.fish
index 3a44cefe..acdc4110 100644
--- a/.config/fish/functions/tide/configure/configs/classic_16color.fish
+++ b/.config/fish/functions/tide/configure/configs/classic_16color.fish
@@ -10,6 +10,8 @@ tide_context_bg_color black
tide_context_color_default yellow
tide_context_color_root bryellow
tide_context_color_ssh yellow
+tide_crystal_bg_color black
+tide_crystal_color brwhite
tide_docker_bg_color black
tide_docker_color blue
tide_git_bg_color black
diff --git a/.config/fish/functions/tide/configure/configs/lean.fish b/.config/fish/functions/tide/configure/configs/lean.fish
index 7381198c..2565e0a1 100644
--- a/.config/fish/functions/tide/configure/configs/lean.fish
+++ b/.config/fish/functions/tide/configure/configs/lean.fish
@@ -20,6 +20,10 @@ tide_context_bg_color normal
tide_context_color_default D7AF87
tide_context_color_root $_tide_color_gold
tide_context_color_ssh D7AF87
+tide_context_hostname_parts 1
+tide_crystal_bg_color normal
+tide_crystal_color FFFFFF
+tide_crystal_icon ⬢
tide_docker_bg_color normal
tide_docker_color 2496ED
tide_docker_default_contexts default colima
@@ -85,7 +89,7 @@ tide_pwd_icon_home
tide_pwd_icon_unwritable 
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled false
-tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell
+tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell crystal
tide_right_prompt_prefix ' '
tide_right_prompt_separator_diff_color ' '
tide_right_prompt_separator_same_color ' '
diff --git a/.config/fish/functions/tide/configure/configs/lean_16color.fish b/.config/fish/functions/tide/configure/configs/lean_16color.fish
index a836852b..49a86064 100644
--- a/.config/fish/functions/tide/configure/configs/lean_16color.fish
+++ b/.config/fish/functions/tide/configure/configs/lean_16color.fish
@@ -10,6 +10,8 @@ tide_context_bg_color normal
tide_context_color_default yellow
tide_context_color_root bryellow
tide_context_color_ssh yellow
+tide_crystal_bg_color normal
+tide_crystal_color brwhite
tide_docker_bg_color normal
tide_docker_color blue
tide_git_bg_color normal
diff --git a/.config/fish/functions/tide/configure/configs/rainbow.fish b/.config/fish/functions/tide/configure/configs/rainbow.fish
index 84f15adb..39ce7bba 100644
--- a/.config/fish/functions/tide/configure/configs/rainbow.fish
+++ b/.config/fish/functions/tide/configure/configs/rainbow.fish
@@ -20,6 +20,10 @@ tide_context_bg_color 444444
tide_context_color_default D7AF87
tide_context_color_root $_tide_color_gold
tide_context_color_ssh D7AF87
+tide_context_hostname_parts 1
+tide_crystal_bg_color FFFFFF
+tide_crystal_color 000000
+tide_crystal_icon ⬢
tide_docker_bg_color 2496ED
tide_docker_color 000000
tide_docker_default_contexts default colima
@@ -85,7 +89,7 @@ tide_pwd_icon_home
tide_pwd_icon_unwritable 
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled true
-tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell
+tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell crystal
tide_right_prompt_prefix 
tide_right_prompt_separator_diff_color 
tide_right_prompt_separator_same_color 
diff --git a/.config/fish/functions/tide/configure/configs/rainbow_16color.fish b/.config/fish/functions/tide/configure/configs/rainbow_16color.fish
index 0a660949..c102e2f3 100644
--- a/.config/fish/functions/tide/configure/configs/rainbow_16color.fish
+++ b/.config/fish/functions/tide/configure/configs/rainbow_16color.fish
@@ -10,6 +10,8 @@ tide_context_bg_color brblack
tide_context_color_default yellow
tide_context_color_root yellow
tide_context_color_ssh yellow
+tide_crystal_bg_color brwhite
+tide_crystal_color black
tide_docker_bg_color blue
tide_docker_color black
tide_git_bg_color green