Update sway with some fixes, update fish stuff

This commit is contained in:
askiiart 2024-01-03 18:58:34 -05:00
parent 118250f033
commit 40ecaef7aa
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67
24 changed files with 145 additions and 48 deletions

View file

@ -1,7 +1,7 @@
function _tide_item_direnv
set -q DIRENV_DIR || return
direnv status | string match -q 'Found RC allowed false' \
&& set -lx tide_direnv_color $tide_direnv_color_denied \
&& set -lx tide_direnv_bg_color $tide_direnv_bg_color_denied
direnv status | string match -q 'Found RC allowed false' &&
set -lx tide_direnv_color $tide_direnv_color_denied &&
set -lx tide_direnv_bg_color $tide_direnv_bg_color_denied
_tide_print_item direnv $tide_direnv_icon
end

View file

@ -1,8 +1,8 @@
function _tide_item_gcloud
set -q CLOUDSDK_CONFIG || set -l CLOUDSDK_CONFIG ~/.config/gcloud
path is $CLOUDSDK_CONFIG/active_config \
&& read -l config <$CLOUDSDK_CONFIG/active_config \
&& path is $CLOUDSDK_CONFIG/configurations/config_$config \
&& string match -qr '^\s*project\s*=\s*(?<project>.*)' <$CLOUDSDK_CONFIG/configurations/config_$config \
&& _tide_print_item gcloud $tide_gcloud_icon' ' $project
path is $CLOUDSDK_CONFIG/active_config &&
read -l config <$CLOUDSDK_CONFIG/active_config &&
path is $CLOUDSDK_CONFIG/configurations/config_$config &&
string match -qr '^\s*project\s*=\s*(?<project>.*)' <$CLOUDSDK_CONFIG/configurations/config_$config &&
_tide_print_item gcloud $tide_gcloud_icon' ' $project
end

View file

@ -1,3 +1,7 @@
function _tide_item_jobs
set -q _tide_jobs && _tide_print_item jobs $tide_jobs_icon
set -q _tide_jobs && if test $_tide_jobs -ge $tide_jobs_number_threshold
_tide_print_item jobs $tide_jobs_icon' ' $_tide_jobs
else
_tide_print_item jobs $tide_jobs_icon
end
end

View file

@ -1,7 +1,10 @@
function _tide_item_python
if test -n "$VIRTUAL_ENV"
python --version | string match -qr "(?<v>[\d.]+)"
if command -q python3
python3 --version | string match -qr "(?<v>[\d.]+)"
else
python --version | string match -qr "(?<v>[\d.]+)"
end
string match -qr "^.*/(?<dir>.*)/(?<base>.*)" $VIRTUAL_ENV
# pipenv $VIRTUAL_ENV looks like /home/ilan/.local/share/virtualenvs/pipenv_project-EwRYuc3l
# Detect whether we are using pipenv by looking for 'virtualenvs'. If so, remove the hash at the end.
@ -14,7 +17,11 @@ function _tide_item_python
_tide_print_item python $tide_python_icon' ' "$v ($base)"
end
else if path is .python-version Pipfile __init__.py pyproject.toml requirements.txt setup.py
python --version | string match -qr "(?<v>[\d.]+)"
if command -q python3
python3 --version | string match -qr "(?<v>[\d.]+)"
else
python --version | string match -qr "(?<v>[\d.]+)"
end
_tide_print_item python $tide_python_icon' ' $v
end
end

View file

@ -1,6 +1,5 @@
function _tide_item_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
path is $_tide_parent_dirs/.terraform &&
terraform workspace show | string match -v default | read -l w &&
_tide_print_item terraform $tide_terraform_icon' ' $w
end

View file

@ -0,0 +1,6 @@
function _tide_item_zig
if path is $_tide_parent_dirs/build.zig
zig version | string match -qr "(?<v>[\d.]+(-dev)?)"
_tide_print_item zig $tide_zig_icon' ' $v
end
end

View file

@ -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 crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox
for item in aws crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig
contains $item $tide_left_prompt_items $tide_right_prompt_items || continue
set -l cli_names $item

View file

@ -38,7 +38,7 @@ if contains newline $_tide_left_items # two line prompt initialization
eval "
function fish_prompt
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs -q && set -lx _tide_jobs
jobs -q && jobs -p | count | read -lx _tide_jobs
$fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
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)\" &
@ -66,7 +66,7 @@ end"
eval "
function fish_prompt
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs -q && set -lx _tide_jobs
jobs -q && jobs -p | count | read -lx _tide_jobs
$fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
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)\" &
@ -98,7 +98,7 @@ else # one line prompt initialization
function fish_prompt
set -lx _tide_status \$status
_tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs -q && set -lx _tide_jobs
jobs -q && jobs -p | count | read -lx _tide_jobs
$fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
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)\" &
@ -125,7 +125,7 @@ end"
eval "
function fish_prompt
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs -q && set -lx _tide_jobs
jobs -q && jobs -p | count | read -lx _tide_jobs
$fish_path -c \"set _tide_pipestatus \$_tide_pipestatus
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)\" &
@ -153,13 +153,19 @@ if test "$tide_prompt_transient_enabled" = true
function _tide_enter_transient
# If the commandline will be executed, or is empty
if commandline --is-valid || test -z "$(commandline)"
set -g _tide_transient
set -g _tide_repaint
commandline -f repaint
# Pager open usually means selecting, not running
# Can be untrue, but it's better than the alternative
if not commandline --paging-mode
set -g _tide_transient
set -g _tide_repaint
commandline -f repaint
end
end
commandline -f execute
end
bind \r _tide_enter_transient
bind \n _tide_enter_transient
bind -M insert \r _tide_enter_transient
bind -M insert \n _tide_enter_transient
end

View file

@ -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 6.0.1'
echo 'tide, version 6.1.1'
else if set -q _flag_help
_tide_help
else if functions --query _tide_sub_$argv[1]

View file

@ -46,6 +46,7 @@ tide_java_bg_color 444444
tide_java_color ED8B00
tide_jobs_bg_color 444444
tide_jobs_color $_tide_color_dark_green
tide_jobs_number_threshold 1000
tide_kubectl_bg_color 444444
tide_kubectl_color 326CE5
tide_left_prompt_frame_enabled true
@ -76,11 +77,11 @@ tide_pwd_bg_color 444444
tide_pwd_color_anchors $_tide_color_light_blue
tide_pwd_color_dirs $_tide_color_dark_blue
tide_pwd_color_truncated_dirs 8787AF
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_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 build.zig
tide_python_bg_color 444444
tide_python_color 00AFAF
tide_right_prompt_frame_enabled true
tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig
tide_right_prompt_prefix
tide_right_prompt_separator_diff_color
tide_right_prompt_separator_same_color
@ -111,3 +112,5 @@ tide_vi_mode_color_default 949494
tide_vi_mode_color_insert 87AFAF
tide_vi_mode_color_replace 87AF87
tide_vi_mode_color_visual FF8700
tide_zig_bg_color 444444
tide_zig_color F7A41D

View file

@ -85,3 +85,5 @@ tide_vi_mode_color_default white
tide_vi_mode_color_insert cyan
tide_vi_mode_color_replace green
tide_vi_mode_color_visual yellow
tide_zig_bg_color black
tide_zig_color yellow

View file

@ -46,6 +46,7 @@ tide_java_bg_color normal
tide_java_color ED8B00
tide_jobs_bg_color normal
tide_jobs_color $_tide_color_dark_green
tide_jobs_number_threshold 1000
tide_kubectl_bg_color normal
tide_kubectl_color 326CE5
tide_left_prompt_frame_enabled false
@ -76,11 +77,11 @@ tide_pwd_bg_color normal
tide_pwd_color_anchors $_tide_color_light_blue
tide_pwd_color_dirs $_tide_color_dark_blue
tide_pwd_color_truncated_dirs 8787AF
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_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 build.zig
tide_python_bg_color normal
tide_python_color 00AFAF
tide_right_prompt_frame_enabled false
tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig
tide_right_prompt_prefix ' '
tide_right_prompt_separator_diff_color ' '
tide_right_prompt_separator_same_color ' '
@ -111,3 +112,5 @@ tide_vi_mode_color_default 949494
tide_vi_mode_color_insert 87AFAF
tide_vi_mode_color_replace 87AF87
tide_vi_mode_color_visual FF8700
tide_zig_bg_color normal
tide_zig_color F7A41D

View file

@ -85,3 +85,5 @@ tide_vi_mode_color_default white
tide_vi_mode_color_insert cyan
tide_vi_mode_color_replace green
tide_vi_mode_color_visual yellow
tide_zig_bg_color normal
tide_zig_color yellow

View file

@ -46,6 +46,7 @@ tide_java_bg_color ED8B00
tide_java_color 000000
tide_jobs_bg_color 444444
tide_jobs_color 4E9A06
tide_jobs_number_threshold 1000
tide_kubectl_bg_color 326CE5
tide_kubectl_color 000000
tide_left_prompt_frame_enabled true
@ -76,11 +77,11 @@ tide_pwd_bg_color 3465A4
tide_pwd_color_anchors E4E4E4
tide_pwd_color_dirs E4E4E4
tide_pwd_color_truncated_dirs BCBCBC
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_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 build.zig
tide_python_bg_color 444444
tide_python_color 00AFAF
tide_right_prompt_frame_enabled true
tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig
tide_right_prompt_prefix
tide_right_prompt_separator_diff_color
tide_right_prompt_separator_same_color
@ -111,3 +112,5 @@ tide_vi_mode_color_default 000000
tide_vi_mode_color_insert 000000
tide_vi_mode_color_replace 000000
tide_vi_mode_color_visual 000000
tide_zig_bg_color F7A41D
tide_zig_color 000000

View file

@ -89,3 +89,5 @@ tide_vi_mode_icon_default D
tide_vi_mode_icon_insert I
tide_vi_mode_icon_replace R
tide_vi_mode_icon_visual V
tide_zig_bg_color yellow
tide_zig_color black

View file

@ -31,9 +31,10 @@ tide_rustc_icon 
tide_shlvl_icon
tide_status_icon
tide_status_icon_failure
tide_terraform_icon
tide_terraform_icon 󱁢
tide_toolbox_icon
tide_vi_mode_icon_default D
tide_vi_mode_icon_insert I
tide_vi_mode_icon_replace R
tide_vi_mode_icon_visual V
tide_zig_icon