From d7c3ccf90f5a0bb2f7c4835e5d632da7f65f4d88 Mon Sep 17 00:00:00 2001 From: jabuxas Date: Sat, 16 Nov 2024 13:13:21 -0300 Subject: [PATCH] feat: add pstf function --- desktop/configs/fish/.config/fish/config.fish | 33 ++++++++++++++++++- .../configs/fish/.config/fish/fish_variables | 2 +- desktop/configs/shell-files/.zshrc | 12 +------ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/desktop/configs/fish/.config/fish/config.fish b/desktop/configs/fish/.config/fish/config.fish index 93d93ab..e6960d9 100644 --- a/desktop/configs/fish/.config/fish/config.fish +++ b/desktop/configs/fish/.config/fish/config.fish @@ -20,13 +20,18 @@ if status is-interactive alias reboot="systemctl reboot" alias hr="date +'%Hh:%M, %d-%m-%Y'" alias hi="systemctl hibernate" - alias ff="fastfetch" + alias ff="fastfetch --config examples/19" alias feh="imv" alias lg="lazygit" alias cpr="cd ~/repos/cports-docker && docker compose run --build --rm cports" alias cop="wl-copy" alias poweroff="systemctl poweroff" alias cat="bat" + + alias protontricks='flatpak run com.github.Matoking.protontricks' + alias protontricks-launch='flatpak run --command=protontricks-launch com.github.Matoking.protontricks' + + alias generate_token="curl -u jabuxas https://paste.jabuxas.xyz | wl-copy" end function pst @@ -55,6 +60,32 @@ function pst end end +function pstf + set -l file + set -l use_ansifilter false + + if command -v ansifilter > /dev/null + set use_ansifilter true + end + + if command test -p /dev/stdin + set file "/tmp/tmp.txt" + if test $use_ansifilter = true + ansifilter > $file + else + cat > $file + end + else if test -n "$argv[1]" + set file "$argv[1]" + end + + curl -F "file=@$file" -Fsecret= -H "X-Auth: $(cat ~/.key)" https://paste.jabuxas.xyz + + if command test -p /dev/stdin + rm "$file" + end +end + function last_history_item echo $history[1] end diff --git a/desktop/configs/fish/.config/fish/fish_variables b/desktop/configs/fish/.config/fish/fish_variables index 75cb99d..608307c 100644 --- a/desktop/configs/fish/.config/fish/fish_variables +++ b/desktop/configs/fish/.config/fish/fish_variables @@ -26,7 +26,7 @@ SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrbl SETUVAR fish_color_status:red SETUVAR fish_color_user:brgreen SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_vi_key_bindings +SETUVAR fish_key_bindings:fish_default_key_bindings SETUVAR fish_pager_color_background:\x1d SETUVAR fish_pager_color_completion:B3A06D SETUVAR fish_pager_color_description:B3A06D diff --git a/desktop/configs/shell-files/.zshrc b/desktop/configs/shell-files/.zshrc index 41976cd..ad8714e 100644 --- a/desktop/configs/shell-files/.zshrc +++ b/desktop/configs/shell-files/.zshrc @@ -65,20 +65,10 @@ fi pst() { local file - local use_ansifilter=false - - # Check if ansifilter exists - if command -v ansifilter >/dev/null 2>&1; then - use_ansifilter=true - fi if [[ -p /dev/stdin ]]; then file=$(mktemp) - if $use_ansifilter; then - ansifilter > "$file" - else - cat > "$file" - fi + cat > "$file" elif [[ -n $1 ]]; then file="$1" else