1
Fork 0
mirror of https://github.com/Steffo99/config-fish.git synced 2024-10-16 06:17:34 +00:00

Add a few things

This commit is contained in:
Steffo 2024-09-03 01:29:03 +02:00
parent b02fc35327
commit 9b19d36801
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
20 changed files with 1943 additions and 42 deletions

View file

@ -1,17 +0,0 @@
function __fish_pipx_complete
set -x _ARGCOMPLETE 1
set -x _ARGCOMPLETE_DFS \t
set -x _ARGCOMPLETE_IFS \n
set -x _ARGCOMPLETE_SUPPRESS_SPACE 1
set -x _ARGCOMPLETE_SHELL fish
set -x COMP_LINE (commandline -p)
set -x COMP_POINT (string length (commandline -cp))
set -x COMP_TYPE
if set -q _ARC_DEBUG
pipx 8>&1 9>&2 1>&9 2>&1
else
pipx 8>&1 9>&2 1>/dev/null 2>&1
end
end
complete --command pipx -f -a '(__fish_pipx_complete)'

1825
completions/uv.fish Normal file

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
fish_add_path ~"/.local/bin"

View file

@ -1,3 +0,0 @@
fish_add_path ~"/.local/share/gem/ruby/3.0.0/bin"
fish_add_path ~"/.gem/ruby/3.0.0/bin"

View file

@ -18,4 +18,3 @@ set -U "fish_color_autosuggestion" "brblack"
set -U "fish_color_cancel" "white" "--background=brred" set -U "fish_color_cancel" "white" "--background=brred"
set -U "DOTFISH_LOG_LEVEL" "50" set -U "DOTFISH_LOG_LEVEL" "50"

View file

View file

@ -1,7 +1,7 @@
function fish_prompt function fish_prompt
# Save variables before they are gone # Save variables before they are gone
set "STATUS" $status set "DOTFISH_STATUS" $status
set "UID" (id -u) set "DOTFISH_UID" (id -u)
# User name # User name
@ -65,16 +65,16 @@ function fish_prompt
# Exit status # Exit status
if test $STATUS -ne 0 if test $DOTFISH_STATUS -ne 0
set_color brred set_color brred
echo -n "[$STATUS]" echo -n "[$DOTFISH_STATUS]"
end end
set_color normal set_color normal
# Dollar # Dollar
set_color --bold white set_color --bold white
if test "$UID" -eq 0 if test "$DOTFISH_UID" -eq 0
echo -n "# " echo -n "# "
else else
echo -n "\$ " echo -n "\$ "

View file

@ -0,0 +1,74 @@
function fish_right_prompt
if [ -f "compose.yml" ]
set --local docker_pod_name (docker compose config --format="json" | jq --raw-output '.name')
set --local docker_pod_states_output (docker compose ps --format="json" --all | jq --slurp --raw-output '.[].State')
set --local docker_pod_created_count (echo "$docker_pod_states_output" | grep --only-matching 'created' - | wc --lines)
set --local docker_pod_running_count (echo "$docker_pod_states_output" | grep --only-matching 'running' - | wc --lines)
set --local docker_pod_restarting_count (echo "$docker_pod_states_output" | grep --only-matching 'restarting' - | wc --lines)
set --local docker_pod_exited_count (echo "$docker_pod_states_output" | grep --only-matching 'exited' - | wc --lines)
set --local docker_pod_paused_count (echo "$docker_pod_states_output" | grep --only-matching 'paused' - | wc --lines)
set --local docker_pod_dead_count (echo "$docker_pod_states_output" | grep --only-matching 'dead' - | wc --lines)
set_color white
echo -n -- "{"
set_color reset
if [ "$docker_pod_dead_count" -gt 0 ]
set_color --bold brblack
else if [ "$docker_pod_exited_count" -gt 0 ]
set_color --bold brred
else if [ "$docker_pod_restarting_count" -gt 0 ]
set_color --bold brmagenta
else if [ "$docker_pod_paused_count" -gt 0 ]
set_color --bold bryellow
else if [ "$docker_pod_running_count" -gt 0 ]
set_color --bold brgreen
else if [ "$docker_pod_created_count" -gt 0 ]
set_color --bold brcyan
else
set_color --bold brwhite
end
echo -n -- "$docker_pod_name"
set_color reset
if [ "$docker_pod_dead_count" -gt 0 ]
set_color brblack
echo -n -- " $docker_pod_dead_count"
set_color reset
end
if [ "$docker_pod_exited_count" -gt 0 ]
set_color brred
echo -n -- " $docker_pod_exited_count"
set_color reset
end
if [ "$docker_pod_restarting_count" -gt 0 ]
set_color brmagenta
echo -n -- " $docker_pod_restarting_count"
set_color reset
end
if [ "$docker_pod_paused_count" -gt 0 ]
set_color bryellow
echo -n -- " $docker_pod_paused_count"
set_color reset
end
if [ "$docker_pod_running_count" -gt 0 ]
set_color brgreen
echo -n -- " $docker_pod_running_count"
set_color reset
end
if [ "$docker_pod_created_count" -gt 0 ]
set_color brcyan
echo -n -- " $docker_pod_created_count"
set_color reset
end
set_color white
echo -n -- "}"
set_color reset
end
end

View file

@ -5,11 +5,11 @@ function log-d
set_color blue set_color blue
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --bold brblue set_color --bold brblue
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color blue set_color blue
echo -n -- " $argv[3]" echo -n -- " $argv[3]"

View file

@ -5,14 +5,14 @@ function log-e
set_color red set_color red
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --bold brred set_color --bold brred
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color red set_color red
echo -n -- " $argv[3]" echo -n -- " $argv[3]"
echo echo
set_color normal set_color reset
end end

View file

@ -6,12 +6,12 @@ function log-f
set_color --background red set_color --background red
set_color brwhite set_color brwhite
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --background brred set_color --background brred
set_color --bold brwhite set_color --bold brwhite
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color --background red set_color --background red
set_color brwhite set_color brwhite

View file

@ -5,11 +5,11 @@ function log-i
set_color cyan set_color cyan
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --bold brcyan set_color --bold brcyan
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color cyan set_color cyan
echo -n -- " $argv[3]" echo -n -- " $argv[3]"

View file

@ -5,11 +5,11 @@ function log-s
set_color green set_color green
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --bold brgreen set_color --bold brgreen
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color green set_color green
echo -n -- " $argv[3]" echo -n -- " $argv[3]"

View file

@ -5,11 +5,11 @@ function log-t
set_color purple set_color purple
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --bold brpurple set_color --bold brpurple
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color purple set_color purple
echo -n -- " $argv[3]" echo -n -- " $argv[3]"

View file

@ -5,11 +5,11 @@ function log-w
set_color yellow set_color yellow
echo -n -- "$argv[1] " echo -n -- "$argv[1] "
set_color normal set_color reset
set_color --bold bryellow set_color --bold bryellow
echo -n -- "$argv[2]" echo -n -- "$argv[2]"
set_color normal set_color reset
set_color yellow set_color yellow
echo -n -- " $argv[3]" echo -n -- " $argv[3]"

9
functions/ssh-start.fish Normal file
View file

@ -0,0 +1,9 @@
which ssh-agent --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function ssh-start
log-t "Starting" "ssh-agent" "..."
eval (ssh-agent -c)
log-t "Adding" "private key" "to the agent..."
ssh-add ~/.ssh/id_ed25519
end
end

View file

@ -1,6 +1,7 @@
which docker --skip-functions >/dev/null 2>/dev/null which docker --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ] if [ $status -eq 0 ]
function video-telegram function video-telegram
log-t "Converting" "$argv[1]" "to chat optimized format..."
ffmpeg -i "$argv[1]" -filter:v 'scale=480:-1' -c:v 'h264_nvenc' -c:a 'copy' -crf '29' "$argv[1].crf29.mp4" ffmpeg -i "$argv[1]" -filter:v 'scale=480:-1' -c:v 'h264_nvenc' -c:a 'copy' -crf '29' "$argv[1].crf29.mp4"
end end
end end

4
functions/work-on.fish Normal file
View file

@ -0,0 +1,4 @@
function work-on --wraps="cd /mnt/work/steffo"
set --global DOTFISH_WORKSPACE $argv[1]
cd "/mnt/work/steffo/$DOTFISH_WORKSPACE" $argv[2..-1]
end

5
path/cargo.fish Normal file
View file

@ -0,0 +1,5 @@
which cargo --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
log-t "Adding" "cargo" "binaries to the PATH..."
fish_add_path ~"/.cargo/bin"
end

5
path/uv.fish Normal file
View file

@ -0,0 +1,5 @@
which uv --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
log-t "Adding" "uv" "binaries to the PATH..."
fish_add_path ~"/.local/bin"
end