diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-10-13 22:56:18 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-10-13 22:58:22 +0800 |
| commit | 542fa9ffaef0691a3a9f4ffef65f12e22c57d849 (patch) | |
| tree | e3f56a823778188e418eeec2642d5785d3ae3c0e /dot-config | |
| parent | 0c7001019bb345d59892de88c355b653d2680fdb (diff) | |
bump
Diffstat (limited to 'dot-config')
31 files changed, 1573 insertions, 13 deletions
diff --git a/dot-config/Thunar/accels.scm b/dot-config/Thunar/accels.scm index 97624bc6..6da979fa 100755 --- a/dot-config/Thunar/accels.scm +++ b/dot-config/Thunar/accels.scm @@ -71,7 +71,6 @@ ; (gtk_accel_path "<Actions>/ThunarWindow/remove-from-recent" "") ; (gtk_accel_path "<Actions>/ThunarActionManager/open-with-other" "") ; (gtk_accel_path "<Actions>/ThunarStandardView/invert-selection" "<Primary><Shift>i") -; (gtk_accel_path "<Actions>/ThunarBookmarks/3b616cd47a6533718043eca0de76abf3" "") ; (gtk_accel_path "<Actions>/ThunarWindow/view-side-pane-shortcuts" "<Primary>b") ; (gtk_accel_path "<Actions>/ThunarWindow/reload-alt-2" "Reload") ; (gtk_accel_path "<Actions>/ThunarWindow/view-location-selector-menu" "") diff --git a/dot-config/btop/btop.conf b/dot-config/btop/btop.conf index 66042cd5..44aae1fe 100644 --- a/dot-config/btop/btop.conf +++ b/dot-config/btop/btop.conf @@ -57,7 +57,7 @@ update_ms = 1500 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "cpu direct" +proc_sorting = "memory" #* Reverse sorting order, True or False. proc_reversed = False diff --git a/dot-config/dconf/user b/dot-config/dconf/user Binary files differindex 2df662da..e8b5182d 100644 --- a/dot-config/dconf/user +++ b/dot-config/dconf/user diff --git a/dot-config/fish/conf.d/abbr.fish b/dot-config/fish/conf.d/abbr.fish new file mode 100644 index 00000000..3d1cf214 --- /dev/null +++ b/dot-config/fish/conf.d/abbr.fish @@ -0,0 +1,351 @@ +abbr -a cleanram "sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'" +abbr -a trim_all "sudo fstrim -va" +abbr -a mkgrub "sudo grub-mkconfig -o /boot/grub/grub.cfg" +abbr -a nmap "sudo nmap" +# alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg' +abbr -a update-grub "sudo update-grub" +abbr -a mtar "tar -zcvf" +abbr -a utar "tar -zxvf" +abbr -a z "zip -r" +abbr -a uz unzip +# alias unzip='ouch d' +# alias compress='ouch c' +# alias zip='ouch c' +abbr -a zip "ouch c" +abbr -a compress zip +abbr -a sr "source ~/.config/zsh/env.zsh" +abbr -a .. "cd .." +abbr -a psg "ps aux | grep -v grep | grep -i -e VSZ -e" +abbr -a mkdir "mkdir -p" +abbr -a fm ranger + +abbr -a cat "bat --plain --pager=never" +# alias grep='grep --color=auto' +abbr -a grep "rg --no-heading --with-filename --smart-case -F" +abbr -a mv "mv -v" +abbr -a cp "cp --reflink=auto -vr" +abbr -a rm "trash -v" + +abbr -a gpt sgpt +abbr -a chat gpt +abbr -a chatgpt chat +# chatgpt +#alias chatgpt='chatgpt-cli' + +# alias ls="exa --color=auto --icons" # lsd same +#alias l="ls -l" +#alias la="ls -a" +#alias lla="ls -la" +#alias lt="ls --tree" +# alias cat="bat --color always --plain" + +# better ls +if set -q DISPLAY + alias ls "eza --color=auto --icons=always --hyperlink" +else + alias ls "eza --color=auto" +end +abbr -a l "ls -l" +abbr -a ll "ls -l" +abbr -a la "ls -a" +abbr -a lla "ls -laa" +abbr -a lah "ls -laah" +abbr -a lm "ls -m" +abbr -a lr "ls -R" +abbr -a lg "ls -l --group-directories-first" + +# common alias +# restart terminal +abbr -a rel "exec /bin/zsh" +abbr -a reload "exec /bin/zsh" +abbr -a news "exec /bin/zsh" +abbr -a refresh "exec /bin/zsh" +abbr -a cls clear +# better vims +abbr -a record "asciinema rec" +abbr -a rec "asciinema rec" +# libreoffice +abbr -a librewriter "libreoffice --writer" +abbr -a librecalc "libreoffice --calc" +abbr -a librebase "libreoffice --base" +abbr -a libredraw "libreoffice --draw" +abbr -a libreimpress "libreoffice --impress" +abbr -a libremath "libreoffice --math" +# noouput programe +#alias nooutput='$1 > /dev/null 2>&1 &' +# wps test +abbr -a wps ttyper +abbr -a wps-cli ttyper +abbr -a wps-test ttyper +# web2app +abbr -a web2app "nativefier --name " +# alias vim='kak' +#alias vim='/home/system/scripts/vim' +#alias vim='lvim' +# copy/paste from terminal +abbr -a copy wl-copy +abbr -a paste wl-paste +# port forwarding & webserver +abbr -a cloudflarepf "cloudflared tunnel --url localhost:" +abbr -a portforward "cloudflared tunnel --url localhost:" +abbr -a ngrokpf "ngrok http " +function webserver + echo clearing background jobs + fg &>/dev/null + echo starting python webserver and making it go to background + sudo python3 -m http.server 80 & + echo forwarding the python server with cloudflare and it might not sussess + cloudflared tunnel --url http://127.0.0.1:80 + echo pulling out python server from background for quit + fg + fg &>/dev/null + fg &>/dev/null +end +abbr -a localwebserver "sudo python3 -m http.server 80" +# vpn(hide.me) +abbr -a open-vpn "systemctl start hide.me@free-us.hideservers.net" +abbr -a start-vpn "systemctl start hide.me@free-us.hideservers.net" +abbr -a close-vpn "systemctl stop hide.me@free-us.hideservers.net" +abbr -a stop-vpn "systemctl stop hide.me@free-us.hideservers.net" +# open +abbr -a open xdg-open +# image clear water mark +abbr -a cwater-mark "lama-cleaner > /dev/null 2>&1 &" +# stablediffusion +function aimage + cd /mnt/DATA/Code/AI/stable-diffusion-webui + ./webui.sh --use-cpu all --no-half + cd - +end +abbr -a stablediffusion aimage +# better python +abbr -a python bpython +abbr -a python3 bpython +abbr -a pip "python -m pip" +abbr -a pipreqr "pip3 install -r requirements.txt" +abbr -a pipreqsi installpipreqs +# better discord +#alias discord='discord-screenaudio' +# better wget +abbr -a wget "aria2c -x 16" +# audios +abbr -a audio pulsemixer +abbr -a audiod pipewire-pulse +# alias audiod='pipewire*' +abbr -a config-bspwm "vim ~/.config/bspwm/bspwmrc" +abbr -a config-keybind "vim ~/.config/bspwm/sxhkdrc" +abbr -a config-polybar "vim ~/.config/bspwm/themes/default/polybar/config.ini" +# better less/cat +# alias less='bat --pager=always --color always --plain' # moved into utility for auto sudo # nah, the one wont work with pipe +# alias cat='bat --pager=never' # moved into utility for auto sudo # nah, wont work with pipe +# better diff +#alias diff='bat -d' +# tars +abbr -a tarxz "tar -xvJf" +abbr -a targz "tar -xvzf" +# faster(vim) +abbr -a v vim +## auto fuck +# better finds +#alias find='sudo find / | grep ' +#alias findhere='sudo find | grep ' +# ip +abbr -a pubip "curl ifconfig.co" +# port +abbr -a getport "lsof -i" +# map +abbr -a map mapscii +# disk analyser +abbr -a diskana ncdu +# must run as root commands +abbr -a sudo "sudo " +abbr -a root "/usr/bin/sudo -i" +abbr -a "*" sudo +abbr -a visudo "sudo visudo" +abbr -a snap "sudo snap" +abbr -a fucking sudo +abbr -a howdy "sudo howdy" +abbr -a gparted "sudo -E gparted" +abbr -a gpart "sudo gpart" +abbr -a gdisk "sudo gdisk" +abbr -a cgdisk "sudo cgdisk" +abbr -a cfdisk "sudo cfdisk" +abbr -a fdisk "sudo fdisk" +abbr -a blkid "sudo blkid" +abbr -a service systemctl +abbr -a mkinitcpio "sudo mkinitcpio" +abbr -a bpytop "sudo bpytop" +abbr -a debtap "sudo debtap" +abbr -a rpm "sudo rpm" +abbr -a journalctl "sudo journalctl" +abbr -a powertop "sudo powertop" +abbr -a upgrade-grub "grub-mkconfig -o /boot/grub/grub.cfg" +#alias update-grub='sudo update-grub' +abbr -a grub-mkconfig "sudo grub-mkconfig" +abbr -a update-initramfs "mkinitcpio -P" +abbr -a kgupdate "update-initramfs && grub-mkconfig -o /boot/grub/grub.cfg" +abbr -a locale-gen "sudo locale-gen" +abbr -a ufw "sudo ufw" +abbr -a swapon "sudo swapon" +abbr -a swapoff "sudo swapoff" +abbr -a grpck "sudo grpck" +abbr -a pwck "sudo pwck" +#alias npm='sudo npm' +abbr -a npm bun +abbr -a npx bunx +abbr -a powerpill "sudo powerpill" +abbr -a timeshift "sudo timeshift" +abbr -a mount "sudo mount" +abbr -a umount "sudo umount" +# user/group related command +abbr -a usermod "sudo usermod" +abbr -a useradd "sudo useradd" +abbr -a userdel "sudo userdel" +abbr -a pacdiff "sudo -E pacdiff" +# change perms +abbr -a chown "chown -v" +abbr -a getown "sudo chown -R $USER:$USER" +abbr -a getread "sudo chmod +r" +abbr -a geturead "sudo chmod u+r" +abbr -a getgread "sudo chmod g+r" +abbr -a getexec "sudo chmod +x" +abbr -a getuexec "sudo chmod u+x" +abbr -a getgexec "sudo chmod g+x" +abbr -a getwrite "sudo chmod +w" +abbr -a getuwrite "sudo chmod u+w" +abbr -a getgwrite "sudo chmod g+w" +abbr -a pipes "pipes.sh" +# better cd +abbr -a bcd fzf +# view keybinds +abbr -a keybind xev +# bettercap +abbr -a bettercap "sudo bettercap" +abbr -a update "topgrade -y --no-retry" +abbr -a upgrade update +# alias for nix(package manager) +#alias nix-install='nix-env -iA nixpkgs.' +abbr -a nix-remove "nix-env -e" +# pipes.sh config +abbr -a pipes.sh "pipes.sh -r 0" +# installrequirements(with pip)(from requirements.txt) +abbr -a installrequirements "pip install -r requirements.txt" +# alias for python +abbr -a py python3 +# more humenize +abbr -a df "df -h" +abbr -a du "du -h" +#alias free='free -h' +# alias grep='grep --color=always' +abbr -a frep "grep -ir" + +# vim:ft=zsh +# doesn't work in zshenv + +# idk Y but it will say no correct +abbr -a j "nocorrect j" +abbr -a killall "nocorrect killall" +abbr -a mysql mysql + +# alias sys='nu -c sys' +abbr -a usys "systemctl --user" +abbr -a sysu "systemctl --user" +abbr -a sys systemctl +abbr -a process "nu -c ps" + +# compiles +abbr -a compile-run compile-run +abbr -a cmp compile +abbr -a cmpr compilerun +# disasm +abbr -a disasm "objdump -d" +abbr -a discompile "objdump -d" +#alias mpv='mpv --no-audio-display --hwdec=vaapi' +abbr -a backup "rsync --archive --quiet --backup --partial --copy-links --cvs-exclude" +# sent text via ix +abbr -a sendraw ix +abbr -a sentext ix +# custom chat server +abbr -a joinchat "nc 127.0.0.1 8000" +# license +abbr -a license "/usr/bin/cat /mnt/DATA/Code/license.txt" +# alias license.short="sed -n '2p' /mnt/DATA/Code/license.txt" +function license.short + sed -n '634,648p' /mnt/DATA/Code/license.txt +end +# browsh +function browsh + echo "export "(env | grep --color=never LANG=)"" >$HOME/.cache/browsh.LANGcache + set LANG EN + command browsh + eval (cat $HOME/.cache/browsh.LANGcache) + rm $HOME/.cache/browsh.LANGcache +end +# metasploit framework +function msfconsole + msfd; and /usr/bin/msfconsole; or echo "[*] msfd faild to start" +end +# process related stuff +abbr -a processfind "ps -aux | grep -v grep | grep" +abbr -a processf processfind +abbr -a pf processfind + +# alias code='cursor' + +# help +abbr -a help tldr + +abbr -a mt memento-timeline + +# xdg-ninja suggested +abbr -a svn 'svn --config-dir $XDG_CONFIG_HOME/subversion' + +# server stuff +function getfs + scp -P 2002 -R ssh.littleblack111.com:$argv . +end +function putfile + scp -P 2002 -R $argv ssh.littleblack111.com:~ +end +function putfs + scp -P 2002 -R $argv ssh.littleblack111.com:~/server/public-fs +end + +# colors +# alias ping='prettyping' +# alias make='colormake' + +# video screen cast using v4l2 +abbr -a camscreen "wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video9 -x yuv420p" +abbr -a screencam "wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video9 -x yuv420p" +abbr -a camerascreen "wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video9 -x yuv420p" +abbr -a screencamera "wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video9 -x yuv420p" +abbr -a image-clean "iopaint start --host 0.0.0.0 --enable-anime-seg --enable-realesrgan --realesrgan-device cuda --enable-restoreformer --restoreformer-device cuda --enable-gfpgan --gfpgan-device cuda --disable-nsfw-checker --inbrowser --model-dir \$XDG_DATA_HOME/AI/IOPaint/modules" + +# hyprland overlay +abbr -a hyproverlay "hyprctl keyword debug:overlay true" +abbr -a dhyproverlay "hyprctl keyword debug:overlay false" +abbr -a hyproverlayd "hyprctl keyword debug:overlay false" + +abbr -a cavabg "alacritty --class winwrap -e cava" +abbr -a bgcava "alacritty --class winwrap -e cava" + +# cpu freq +abbr -a cpuperf "sudo cpupower frequency-set -g performance" +abbr -a cpups "sudo cpupower frequency-set -g powersave" + +# better time benchmark +abbr -a time "hyperfine --warmup 3 -N" + +function '??' + set file (mktemp) + gh copilot suggest -t shell $argv --shell-out $file + eval (cat $file) + rm $file +end + +abbr -a icat "kitten icat" + +abbr -a mkcd "nocorrect mkcd" + +abbr -a cd z diff --git a/dot-config/fish/conf.d/env.fish b/dot-config/fish/conf.d/env.fish new file mode 100644 index 00000000..e6d4b973 --- /dev/null +++ b/dot-config/fish/conf.d/env.fish @@ -0,0 +1,107 @@ +## +## PATH & ENV Var +## + +# PNPM, Qt/QML, Wine +set -x PNPM_HOME "$HOME/.local/share/pnpm" +set -x QML_IMPORT_PATH /usr/lib/qt6/qml +set -x WINEPREFIX /opt/windows.wine + +# PATHs (Fish keeps PATH as a list; prepend/append with -xg to export globally) +# Preserve order as in your zsh config +set -xg PATH $PNPM_HOME $PATH +set -xg PATH $HOME/scripts $PATH +set -xg PATH $HOME/scripts/bin $PATH +set -xg PATH $PATH $HOME/.local/bin +set -xg PATH $HOME/.cargo/bin $PATH +set -xg PATH $PATH /snap/bin +set -xg PATH $PATH $HOME/.cache/.bun/bin +set -xg PATH $PATH $HOME/go/bin +set -xg PATH $PATH /home/system/.spicetify + +# GPG_TTY and SUDO_PROMPT +# Fish: tty is a builtin; emulate ${TTY:-$(tty)} +if set -q TTY + set -x GPG_TTY "$TTY" +else + set -x GPG_TTY (tty) +end +set -x SUDO_PROMPT "pass: " + +# Term/browser/editor +set -x TERMINAL kitty +set -x BROWSER zen-browser +set -x VISUAL hx +set -x EDITOR "$VISUAL" + +# XDG base dirs +set -x XDG_CONFIG_HOME "$HOME/.config" +set -x XDG_CACHE_HOME "$HOME/.cache" +set -x XDG_DATA_HOME "$HOME/.local/share" +set -x XDG_STATE_HOME "$HOME/.local/state" +set -x XDG_CONFIG_DIRS /etc/xdg +set -x XDG_DATA_DIRS "/usr/local/share:/usr/share:/var/lib/flatpak/exports/share:$XDG_DATA_HOME/flatpak/exports/share" +set -x XDG_RUNTIME_DIR "/run/user/(id -u)" +set -x XDG_DESKTOP_DIR "$HOME/Desktop" +set -x XDG_DOWNLOAD_DIR "$HOME/Downloads" +set -x XDG_TEMPLATES_DIR "$HOME/Templates" +set -x XDG_PUBLICSHARE_DIR "$HOME/Public" +set -x XDG_DOCUMENTS_DIR "$HOME/Documents" +set -x XDG_MUSIC_DIR "$HOME/Music" +set -x XDG_PICTURES_DIR "$HOME/Pictures" +set -x XDG_VIDEOS_DIR "$HOME/Videos" + +# Pager/editor helpers +set -x MANPAGER 'nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=0" +"set showtabline=0" +"set nonumber"' +set -x DIFFPROG 'nvim -d' +# set -x MANPAGER "lvim +Man" + +# If using nvim as MANPAGER, optional LESS termcaps (kept commented as in your file) +# if test (echo $MANPAGER | awk '{print $1}') = nvim +# set -x LESS "--RAW-CONTROL-CHARS" +# # set -x MANPAGER "less -s -M +Gg" +# set -x LESS_TERMCAP_mb \e'[1;32m' +# set -x LESS_TERMCAP_md \e'[1;32m' +# set -x LESS_TERMCAP_me \e'[0m' +# set -x LESS_TERMCAP_se \e'[0m' +# set -x LESS_TERMCAP_so \e'[01;33m' +# set -x LESS_TERMCAP_ue \e'[0m' +# set -x LESS_TERMCAP_us \e'[1;4;31m' +# end + +# less source highlight +set -x LESSOPEN "| /usr/bin/source-highlight-esc.sh %s" +set -x LESS "-R " + +# FZF bases (kept commented) +# set -x FZF_DEFAULT_OPTS " +# --color fg:#cdd6f4 +# --color fg+:#cdd6f4 +# --color bg:#1e1e2e +# --color bg+:#313244 +# --color hl:#f38ba8 +# --color hl+:#f38ba8 +# --color info:#cba6f7 +# --color prompt:#cba6f7 +# --color spinner:#f5e0dc +# --color pointer:#f5e0dc +# --color marker:#f5e0dc +# --color border:#1e1e2e +# --color header:#f38ba8 +# --prompt ' ' +# --pointer ' λ' +# --layout=reverse +# --border horizontal +# --height 40 +# " + +# LS_COLORS (huge; intentionally kept commented as in your file) +# set -x LS_COLORS '...' + +# set -x LANG "zh_CN.UTF-8" + +# vim:ft=zsh:nowrap (left as comment for fidelity) + +# source $HOME/.config/zsh/env.local.zsh +# In Fish, source a Fish file instead if you have one: +# test -f $HOME/.config/fish/env.local.fish; and source $HOME/.config/fish/env.local.fish diff --git a/dot-config/fish/conf.d/funcs.fish b/dot-config/fish/conf.d/funcs.fish new file mode 100644 index 00000000..82c8411b --- /dev/null +++ b/dot-config/fish/conf.d/funcs.fish @@ -0,0 +1,107 @@ +# vim with auto sudo +function vim + if test (count $argv) -eq 0 + if not test -w (pwd) + printf "Opening vim with sudo...\n" + sudo -E $EDITOR + return + else + printf "Opening vim...\n" + $EDITOR + return + end + end + + if not test -e $argv[1] + printf "%s doesn't exist\ntouch File '%s'?(y/N)" $argv[1] $argv[1] + read -l choice + if test "$choice" = y -o "$choice" = Y + echo + if not test -w (dirname $argv[1]) + printf "Opening vim with sudo...\n" + sudo -E $EDITOR $argv[1] + if not test -e $argv[1] + printf "File \"%s\" is isn't saved, auto deleted...\n" $argv[1] + return + end + return + else + printf "Opening vim...\n" + $EDITOR $argv[1] + if not test -e $argv[1] + printf "File \"%s\" is isn't saved, auto deleted...\n" $argv[1] + return + end + return + end + else + printf '\nExiting...\n' + return + end + end + + if not test -w $argv[1] + printf "Opening vim with sudo...\n" + sudo -E $EDITOR $argv[1] + return + else if test -e $argv[1] + printf "Opening vim...\n" + $EDITOR $argv[1] + return + end +end + +function unzip + ouch d --dir (string replace -r '\.[^./]+$' '' -- $argv[1]) $argv +end + +function path + echo (pwd)/$argv[1] +end + +function vimake + if test -e Makefile + $EDITOR Makefile + else + printf "No Makefile" + end +end + +function vimpkg + if test -e PKGBUILD + nvim PKGBUILD + else + printf "No PKGBUILD" + end +end + +function installpipreqs + if test -e requirements.txt + pip install -r requirements.txt + else + echo "There isn't a requirements.txt" + end +end + +function killzombie + set -l pid (ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}') + if test -z "$pid" + echo "No zombie processes found." + else + set -l cmd (ps -p $pid -o cmd | sed '1d') + echo "Found zombie process PID: $pid" + echo "$cmd" + echo "Kill it? Return to continue… (ctrl+c to cancel)" + read -l + sudo kill -9 $pid + end +end + +function createrepo + gh repo create $argv[1] --add-readme --license gpl-3.0 $argv[2..-1] --public + # tea repo create --name $1 --init --readme Default --license gpl3 --branch main ${@:2} +end + +function tempsend + bw send $argv ^/dev/null | jq -r '.accessUrl' +end diff --git a/dot-config/fish/conf.d/git.abbr.fish b/dot-config/fish/conf.d/git.abbr.fish new file mode 100644 index 00000000..5a37d812 --- /dev/null +++ b/dot-config/fish/conf.d/git.abbr.fish @@ -0,0 +1,261 @@ + +#!/bin/bash + +set -x LOG_HASH "%C(always,yellow)%h%C(always,reset)" +set -x LOG_RELATIVE_TIME "%C(always,green)(%ar)%C(always,reset)" +set -x LOG_AUTHOR "%C(always,blue)<%an>%C(always,reset)" +set -x LOG_REFS "%C(always,red)%d%C(always,reset)" +set -x LOG_SUBJECT "%s" + +set -x LOG_FORMAT "$LOG_HASH}$LOG_AUTHOR}$LOG_RELATIVE_TIME}$LOG_SUBJECT $LOG_REFS" + +set -x BRANCH_PREFIX "%(HEAD)" +set -x BRANCH_REF "%(color:red)%(color:bold)%(refname:short)%(color:reset)" +set -x BRANCH_HASH "%(color:yellow)%(objectname:short)%(color:reset)" +set -x BRANCH_DATE "%(color:green)(%(committerdate:relative))%(color:reset)" +set -x BRANCH_AUTHOR "%(color:blue)%(color:bold)<%(authorname)>%(color:reset)" +set -x BRANCH_CONTENTS "%(contents:subject)" + +set -x BRANCH_FORMAT "}$BRANCH_PREFIX}$BRANCH_REF}$BRANCH_HASH}$BRANCH_DATE}$BRANCH_AUTHOR}$BRANCH_CONTENTS" + +function show_git_head + pretty_git_log -1 + git show -p --pretty="tformat:" +end + +function pretty_git_log + git log --since="12 months ago" --graph --pretty="tformat:$LOG_FORMAT" $argv | pretty_git_format | git_page_maybe +end + +function pretty_git_log_all + git log --all --since="12 months ago" --graph --pretty="tformat:$LOG_FORMAT" $argv | pretty_git_format | git_page_maybe +end + +function gb + git branch -v --color=always --format=$BRANCH_FORMAT --sort=-committerdate $argv | pretty_git_format +end + +function pretty_git_format + sed -Ee 's/(^[^)]*) ago\)/\1)/' \ + | sed -Ee 's/(^[^)]*), [[:digit:]]+ .*months?\)/\1)/' \ + | sed -Ee 's/ seconds?\)/s\)/' \ + | sed -Ee 's/ minutes?\)/m\)/' \ + | sed -Ee 's/ hours?\)/h\)/' \ + | sed -Ee 's/ days?\)/d\)/' \ + | sed -Ee 's/ weeks?\)/w\)/' \ + | sed -Ee 's/ months?\)/M\)/' \ + | sed -Ee 's/<Andrew Burgess>/<me>/' \ + | sed -Ee 's/<([^ >]+) [^>]*>/<\1>/' \ + | column -s '}' -t +end + +#alias tree='tree -a -I .git' +# alias commit="git add . && git commit -m" +# alias push="git push" +abbr -a git-rm "git ls-files --deleted -z | xargs -0 git rm" +# alias g=git +#alias ga='git add' +# alias gaa='git add --all' +# alias gam='git am' +# alias gama='git am --abort' +# alias gamc='git am --continue' +# alias gams='git am --skip' +# alias gamscp='git am --show-current-patch' +# alias gap='git apply' +# alias gapa='git add --patch' +# alias gapt='git apply --3way' +# alias gau='git add --update' +# alias gav='git add --verbose' +# alias gb='git branch' +# alias gbD='git branch -D' +# alias gba='git branch -a' +# alias gbd='git branch -d' +# alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch -d 2>/dev/null' +# alias gbl='git blame -b -w' +# alias gbnm='git branch --no-merged' +# alias gbr='git branch --remote' +# alias gbs='git bisect' +# alias gbsb='git bisect bad' +# alias gbsg='git bisect good' +# alias gbsr='git bisect reset' +# alias gbss='git bisect start' +#alias gc='git commit -v' +# alias 'gc!'='git commit -v --amend' +# alias gca='git commit -v -a' +# alias 'gca!'='git commit -v -a --amend' +# alias gcam='git commit -a -m' +# alias 'gcan!'='git commit -v -a --no-edit --amend' +# alias 'gcans!'='git commit -v -a -s --no-edit --amend' +# alias gcas='git commit -a -s' +# alias gcasm='git commit -a -s -m' +# alias gcb='git checkout -b' +# alias gcd='git checkout $(git_develop_branch)' +# alias gcf='git config --list' +# alias gclr='git clone --recurse-submodules' +# alias gcld='git clone --depth' +# alias gclean='git clean -id' +# alias gcm='git checkout $(git_main_branch)' +# alias gcmsg='git commit -m' +# alias 'gcn!'='git commit -v --no-edit --amend' +# alias gco='git checkout' +# alias gcor='git checkout --recurse-submodules' +# alias gcount='git shortlog -sn' +# alias gcp='git cherry-pick' +# alias gcpa='git cherry-pick --abort' +# alias gcpc='git cherry-pick --continue' +# alias gcs='git commit -S' +# alias gcsm='git commit -s -m' +# alias gcss='git commit -S -s' +# alias gcssm='git commit -S -s -m' +abbr -a gd "git diff" +# alias gdca='git diff --cached' +# alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' +# alias gdcw='git diff --cached --word-diff' +# alias gds='git diff --staged' +# alias gdt='git diff-tree --no-commit-id --name-only -r' +# alias gdup='git diff @{upstream}' +# alias gdw='git diff --word-diff' +# alias gf='git fetch' +# alias gfa='git fetch --all --prune --jobs=10' +# alias gfg='git ls-files | grep' +# alias gfo='git fetch origin' +# alias gg='git gui citool' +# alias gga='git gui citool --amend' +# alias ggpull='git pull origin "$(git_current_branch)"' +# alias ggpur=ggu +# alias ggpush='git push origin "$(git_current_branch)"' +# alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' +# alias ghh='git help' +# alias gignore='git update-index --assume-unchanged' +# alias gignored='git ls-files -v | grep "^[[:lower:]]"' +# alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' +# alias gk='\gitk --all --branches &!' +# alias gke='\gitk --all $(git log -g --pretty=%h) &!' +# alias gl='git pull' +# alias glg='git log --stat' +# alias glgg='git log --graph' +# alias glgga='git log --graph --decorate --all' +# alias glgm='git log --graph --max-count=10' +# alias glgp='git log --stat -p' +# alias glo='git log --oneline --decorate' +# alias globurl='noglob urlglobber ' +# alias glod='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'\' +# alias glods='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'\'' --date=short' +# alias glog='git log --oneline --decorate --graph' +# alias gloga='git log --oneline --decorate --graph --all' +# alias glol='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'\' +# alias glola='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'\'' --all' +# alias glols='git log --graph --pretty='\''%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'\'' --stat' +# alias glp=_git_log_prettily +# alias glum='git pull upstream $(git_main_branch)' +# alias gm='git merge' +# alias gma='git merge --abort' +# alias gmom='git merge origin/$(git_main_branch)' +# alias gmtl='git mergetool --no-prompt' +# alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' +# alias gmum='git merge upstream/$(git_main_branch)' +# alias gpd='git push --dry-run' +# alias gpf='git push --force-with-lease' +# alias 'gpf!'='git push --force' +# alias gpoat='git push origin --all && git push origin --tags' +# alias gpr='git pull --rebase' +# alias gpristine='git reset --hard && git clean -dffx' +# alias gpsup='git push --set-upstream origin $(git_current_branch)' +# alias gpu='git push upstream' +# alias gpv='git push -v' +# alias gpd='git push origin --delete' +abbr -a gr "git remote" +# alias gra='git remote add' +# alias grb='git rebase' +# alias grwh='git rm --cached `git ls-files -i -c --exclude-from=.gitignore`' +# alias grwhx='git ls-files -i -c --exclude-from=.gitignore | xargs git rm --cached' +# alias grad='git rm -r --cached . && git add .' +# alias grba='git rebase --abort' +# alias grbc='git rebase --continue' +# alias grbd='git rebase $(git_develop_branch)' +# alias grbi='git rebase -i' +# alias grbm='git rebase $(git_main_branch)' +# alias grbo='git rebase --onto' +# alias grbom='git rebase origin/$(git_main_branch)' +# alias grbs='git rebase --skip' +# alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}' +# alias grev='git revert' +# alias grh='git reset' +# alias grhh='git reset --hard' +# alias grm='git rm' +# alias grmc='git rm --cached' +# alias grmv='git remote rename' +# alias groh='git reset origin/$(git_current_branch) --hard' +# alias grrm='git remote remove' +# alias grs='git restore' +# alias grset='git remote set-url' +# alias grss='git restore --source' +# alias grst='git restore --staged' +# alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' +# alias gru='git reset --' +# alias grup='git remote update' +# alias grv='git remote -v' +# alias gsb='git status -sb' +# alias gsd='git svn dcommit' +# alias gsh='git show' +# alias gsi='git submodule init' +# alias gsps='git show --pretty=short --show-signature' +# alias gsr='git svn rebase' +# alias gss='git status -s' +# alias gst='git status' +# alias gsta='git stash push' +# alias gstaa='git stash apply' +# alias gstall='git stash --all' +# alias gstc='git stash clear' +# alias gstd='git stash drop' +# alias gstl='git stash list' +# alias gstp='git stash pop' +# alias gsts='git stash show --text' +# alias gstu='gsta --include-untracked' +# alias gsu='git submodule update' +# alias gsw='git switch' +# alias gswc='git switch -c' +# alias gswd='git switch $(git_develop_branch)' +# alias gswm='git switch $(git_main_branch)' +# alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl' +# alias gts='git tag -s' +# alias gtv='git tag | sort -V' +# alias gunignore='git update-index --no-assume-unchanged' +# alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' +# alias gup='git pull --rebase' +# alias gupa='git pull --rebase --autostash' +# alias gupav='git pull --rebase --autostash -v' +# alias gupv='git pull --rebase -v' +# alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' +# alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' +# alias gcl='git clone --recurse-submodules' +abbr -a gl "git log --decorate --graph" +function gcl + git clone --recurse-submodules $argv; or gh repo clone $argv -- --recurse-submodules +end +# alias gi='git init' +# alias gl='git log' +#alias ga='git add' +# alias gc='git commit -am' +abbr -a gc "git commit --verbose -S -m" +abbr -a gcnm 'git commit --verbose --allow-empty-message -S -m ""' +abbr -a gca "git commit --verbose -S -am" +# alias gp='git push origin main' +# alias gp='git remote | xargs -L1 git push --all' # moved to funcs +abbr -a gp 'git remote | xargs -L1 git push' +abbr -a gpd 'git remote | xargs -L1 git push --delete' +# alias gpf='git push --force-with-lease' +abbr -a gitp 'git remote | xargs -L1 git pull' +abbr -a gs "git status" +abbr -a gitrm "git rm --cached -rf" +# alias gsb='git switch' +# alias gcb='git checkout -b' +# alias gu='ga && gc update && git push' +function ghcl + gh repo clone $argv -- --recurse-submodules +end +# alias ghdb='git push origin --delete' +# alias ghcr='gh repo create' +# alias ghpr='gh pr' +# alias ghis='gh issue' +abbr -a bisectundo 'git bisect log | head -n -2 > /tmp/fixed_bisect.log ; git bisect replay /tmp/fixed_bisect.log' diff --git a/dot-config/fish/conf.d/options.fish b/dot-config/fish/conf.d/options.fish new file mode 100644 index 00000000..21783bad --- /dev/null +++ b/dot-config/fish/conf.d/options.fish @@ -0,0 +1,9 @@ +if ! status is-interactive + return +end + +# set fish_cursor_default line blink +set fish_cursor_default block +set fish_cursor_insert line blink +set fish_cursor_external block +set fish_cursor_visual block diff --git a/dot-config/fish/conf.d/pacman.abbr.fish b/dot-config/fish/conf.d/pacman.abbr.fish new file mode 100644 index 00000000..8e146978 --- /dev/null +++ b/dot-config/fish/conf.d/pacman.abbr.fish @@ -0,0 +1,65 @@ +# pacman/yay helpers + +abbr -a pacman-key "sudo pacman-key" +abbr -a add-pacman-repository "sudo add-pacman-repository" +abbr -a downgrade "sudo downgrade" +# better pacman +#abbr -a pacman "paru" +abbr -a pacman "yay " +#abbr -a pacman "pamac" +#abbr -a pacman "sudo pacman" +#abbr -a apt "pamac" # idk there is a package called apt lmao + +# full system upgrade/update +abbr -a mirror "sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist" +abbr -a mirrord "sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist" +abbr -a mirrors "sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist" +abbr -a mirrora "sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist" +# abbr -a update 'sudo npm update -g & nix-env -u & brew upgrade & flatpak update -y & tldr -u & yay -Syu --noconfirm --disable-download-timeout' # pipx upgrade-all + +# more pacman alis +alias packagelistignoreall 'paru --color always -Sl | sed -e "s: :/:; s/ unknown-version//; /已安装/d" | fzf --multi --ansi --preview "yay -Si {1}" | cut -d" " -f1 | xargs -ro yay -S' +alias package "paru --color always -Sl \ + | fzf --multi --ansi --preview 'yay -Si {2}' \ + | awk '{print $2}' \ + | xargs -r yay -S --noconfirm" +# abbr -a packagelist 'paru --color always -Sl | sed -e "s: :/:; /unknown-version/d" | fzf --multi --ansi --preview "yay -Si {1}" | cut -d" " -f1 | xargs -ro yay -S' +alias packagef "/usr/bin/cat /tmp/yaySl | cut -d' ' -f2 | fzf --multi --ansi --preview 'yay -Si {1}' | xargs -ro paru -S --skipreview --needed" +abbr -a pi "pacman --noconfirm -S --needed" +abbr -a pic "pacman --noconfirm -S --needed --ask 4" +abbr -a pico "pacman --noconfirm -S --overwrite \"*\" --needed --ask 4" +abbr -a picdep "pacman --noconfirm -Sd --needed --ask 4 --nodeps" +abbr -a pidep "pacman --noconfirm -S --asdeps --needed" +abbr -a pindep "pacman --noconfirm -Sd --nodeps" +abbr -a pif "pacman --noconfirm --force -S --needed" +abbr -a pifd "pacman -Sd --needed --nodeps" +abbr -a pio "pacman --noconfirm -S --overwrite \"*\" --needed" +abbr -a prio "pacman --noconfirm -S --overwrite \"*\"" +abbr -a priob "pacman --noconfirm -S --overwrite \"*\" --rebuild" +#abbr -a ps "pacman --noconfirm -S --needed" +abbr -a pr "pacman --noconfirm -Rns" +abbr -a prndep "pacman --noconfirm -Rnsd --nodeps" +abbr -a pri "pacman --noconfirm -S" +abbr -a prib "pacman --noconfirm -S --rebuild" +abbr -a pc "pacman -Scc" +abbr -a clean "pacman -Scc" +abbr -a pf "pacman --noconfirm " +abbr -a p pacman +abbr -a autoremove 'pacman -Rcns (pacman -Qdtq)' +abbr -a pd downgrade +#abbr -a pi 'nocorrect pi' +#abbr -a pr 'nocorrect pr' +#abbr -a p 'nocorrect p' +#abbr -a pacman 'nocorrect pacman' + +abbr -a pacin 'pacman -Slq | fzf -m --preview \'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")\' | xargs -ro sudo pacman -S' +abbr -a paruin 'paru -Slq | fzf -m --preview \'cat <(paru -Si {1}) <(paru -Fl {1} | awk "{print \$2}")\' | xargs -ro paru -S' +abbr -a pacrem 'pacman -Qq | fzf --multi --preview \'pacman -Qi {1}\' | xargs -ro sudo pacman -Rns' +# abbr -a pac 'pacman -Q | fzf' +abbr -a parucom "paru -Gc" +abbr -a parupd "paru -Qua" +abbr -a pacupd "pacman -Qu" +abbr -a parucheck "paru -Gp" +abbr -a cleanpac 'sudo pacman -Rns (pacman -Qtdq); and paru -c' +abbr -a installed "grep -i installed /var/log/pacman.log" +# abbr -a pacman "sudo pacman" diff --git a/dot-config/fish/conf.d/prompt.options.fish b/dot-config/fish/conf.d/prompt.options.fish new file mode 100644 index 00000000..cc226746 --- /dev/null +++ b/dot-config/fish/conf.d/prompt.options.fish @@ -0,0 +1,9 @@ +# git +set -g __fish_git_prompt_show_informative_status 1 +set -g __fish_git_prompt_showdirtystate 1 +set -g __fish_git_prompt_showuntrackedfiles 1 +set -g __fish_git_prompt_showupstream auto +set -g __fish_git_prompt_showstashstate 1 +set -g __fish_git_prompt_showcolorhints 1 + +set -g fish_prompt_pwd_dir_length 0 diff --git a/dot-config/fish/conf.d/z.fish b/dot-config/fish/conf.d/z.fish new file mode 100644 index 00000000..59c960fc --- /dev/null +++ b/dot-config/fish/conf.d/z.fish @@ -0,0 +1,63 @@ +if test -z "$Z_DATA" + if test -z "$XDG_DATA_HOME" + set -U Z_DATA_DIR "$HOME/.local/share/z" + else + set -U Z_DATA_DIR "$XDG_DATA_HOME/z" + end + set -U Z_DATA "$Z_DATA_DIR/data" +end + +if test ! -e "$Z_DATA" + if test ! -e "$Z_DATA_DIR" + mkdir -p -m 700 "$Z_DATA_DIR" + end + touch "$Z_DATA" +end + +if test -z "$Z_CMD" + set -U Z_CMD z +end + +set -U ZO_CMD "$Z_CMD"o + +if test ! -z $Z_CMD + function $Z_CMD -d "jump around" + __z $argv + end +end + +if test ! -z $ZO_CMD + function $ZO_CMD -d "open target dir" + __z -d $argv + end +end + +if not set -q Z_EXCLUDE + set -U Z_EXCLUDE "^$HOME\$" +else if contains $HOME $Z_EXCLUDE + # Workaround: migrate old default values to a regex (see #90). + set Z_EXCLUDE (string replace -r -- "^$HOME\$" '^'$HOME'$$' $Z_EXCLUDE) +end + +# Setup completions once first +__z_complete + +function __z_on_variable_pwd --on-variable PWD + __z_add +end + +function __z_uninstall --on-event z_uninstall + functions -e __z_on_variable_pwd + functions -e $Z_CMD + functions -e $ZO_CMD + + if test ! -z "$Z_DATA" + printf "To completely erase z's data, remove:\n" >/dev/stderr + printf "%s\n" "$Z_DATA" >/dev/stderr + end + + set -e Z_CMD + set -e ZO_CMD + set -e Z_DATA + set -e Z_EXCLUDE +end diff --git a/dot-config/fish/config.fish b/dot-config/fish/config.fish new file mode 100644 index 00000000..a34c7b2e --- /dev/null +++ b/dot-config/fish/config.fish @@ -0,0 +1,5 @@ +if ! status is-interactive + return +end + +fastfetch diff --git a/dot-config/fish/fish_plugins b/dot-config/fish/fish_plugins new file mode 100644 index 00000000..6ff412d7 --- /dev/null +++ b/dot-config/fish/fish_plugins @@ -0,0 +1 @@ +/mnt/DATA/personal/Code/projects/z diff --git a/dot-config/fish/fish_variables b/dot-config/fish/fish_variables new file mode 100644 index 00000000..b108f2e1 --- /dev/null +++ b/dot-config/fish/fish_variables @@ -0,0 +1,48 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR ZO_CMD:zo +SETUVAR Z_CMD:z +SETUVAR Z_DATA:/home/system/\x2elocal/share/z/data +SETUVAR Z_DATA_DIR:/home/system/\x2elocal/share/z +SETUVAR Z_EXCLUDE:\x5e/home/system\x24 +SETUVAR __fish_initialized:3800 +SETUVAR _fisher__2F_mnt_2F_44_41_TA_2F_personal_2F_43_ode_2F_projects_2F_z_files:\x7e/\x2econfig/fish/functions/__z\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_add\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_clean\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_complete\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/z\x2efish +SETUVAR _fisher_plugins:/mnt/DATA/personal/Code/projects/z +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:normal +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack\x1e\x2d\x2dbold +SETUVAR fish_color_selection:white\x1e\x2d\x2dbackground\x3dbrblack\x1e\x2d\x2dbold +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_greeting:\x1d +SETUVAR fish_key_bindings:fish_vi_key_bindings +SETUVAR fish_pager_color_background:\x1d +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan\x1e\x2d\x2dbold +SETUVAR fish_pager_color_secondary_background:\x1d +SETUVAR fish_pager_color_secondary_completion:\x1d +SETUVAR fish_pager_color_secondary_description:\x1d +SETUVAR fish_pager_color_secondary_prefix:\x1d +SETUVAR fish_pager_color_selected_background:\x2dr +SETUVAR fish_pager_color_selected_completion:\x1d +SETUVAR fish_pager_color_selected_description:\x1d +SETUVAR fish_pager_color_selected_prefix:\x1d diff --git a/dot-config/fish/functions/__z.fish b/dot-config/fish/functions/__z.fish new file mode 100644 index 00000000..8043f8f3 --- /dev/null +++ b/dot-config/fish/functions/__z.fish @@ -0,0 +1,177 @@ +function __z -d "Jump to a recent directory." + function __print_help -d "Print z help." + printf "Usage: $Z_CMD [-celrth] string1 string2...\n\n" + printf " -c --clean Removes directories that no longer exist from $Z_DATA\n" + printf " -d --dir Opens matching directory using system file manager.\n" + printf " -e --echo Prints best match, no cd\n" + printf " -l --list List matches and scores, no cd\n" + printf " -p --purge Delete all entries from $Z_DATA\n" + printf " -r --rank Search by rank\n" + printf " -t --recent Search by recency\n" + printf " -x --delete Removes the current directory from $Z_DATA\n" + printf " -h --help Print this help\n\n" + end + function __z_legacy_escape_regex + # taken from escape_string_pcre2 in fish + # used to provide compatibility with fish 2 + for c in (string split -- '' $argv) + if contains $c (string split '' '.^$*+()?[{}\\|-]') + printf \\ + end + printf '%s' $c + end + end + + set -l options h/help c/clean e/echo l/list p/purge r/rank t/recent d/directory x/delete + + argparse $options -- $argv + + if set -q _flag_help + __print_help + return 0 + else if set -q _flag_clean + __z_clean + printf "%s cleaned!\n" $Z_DATA + return 0 + else if set -q _flag_purge + echo >$Z_DATA + printf "%s purged!\n" $Z_DATA + return 0 + else if set -q _flag_delete + sed -i -e "\:^$PWD|.*:d" $Z_DATA + return 0 + end + + set -l typ + + if set -q _flag_rank + set typ rank + else if set -q _flag_recent + set typ recent + end + + set -l z_script ' + function frecent(rank, time) { + dx = t-time + if( dx < 3600 ) return rank*4 + if( dx < 86400 ) return rank*2 + if( dx < 604800 ) return rank/2 + return rank/4 + } + + function output(matches, best_match, common) { + # list or return the desired directory + if( list ) { + cmd = "sort -nr" + for( x in matches ) { + if( matches[x] ) { + printf "%-10s %s\n", matches[x], x | cmd + } + } + } else { + if( common ) best_match = common + print best_match + } + } + + function common(matches) { + # find the common root of a list of matches, if it exists + for( x in matches ) { + if( matches[x] && (!short || length(x) < length(short)) ) { + short = x + } + } + if( short == "/" ) return + for( x in matches ) if( matches[x] && index(x, short) != 1 ) { + return + } + return short + } + + BEGIN { + hi_rank = ihi_rank = -9999999999 + } + { + if( typ == "rank" ) { + rank = $2 + } else if( typ == "recent" ) { + rank = $3 - t + } else rank = frecent($2, $3) + if( $1 ~ q ) { + matches[$1] = rank + } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank + if( matches[$1] && matches[$1] > hi_rank ) { + best_match = $1 + hi_rank = matches[$1] + } else if( imatches[$1] && imatches[$1] > ihi_rank ) { + ibest_match = $1 + ihi_rank = imatches[$1] + } + } + + END { + # prefer case sensitive + if( best_match ) { + output(matches, best_match, common(matches)) + } else if( ibest_match ) { + output(imatches, ibest_match, common(imatches)) + } + } + ' + + set -l qs + for arg in $argv + set -l escaped $arg + if string escape --style=regex '' >/dev/null 2>&1 # use builtin escape if available + set escaped (string escape --style=regex -- $escaped) + else + set escaped (__z_legacy_escape_regex $escaped) + end + # Need to escape twice, see https://www.math.utah.edu/docs/info/gawk_5.html#SEC32 + set escaped (string replace --all -- \\ \\\\ $escaped) + set qs $qs $escaped + end + set -l q (string join -- '.*' $qs) + + if set -q _flag_list + # Handle list separately as it can print common path information to stderr + # which cannot be captured from a subcommand. + command awk -v t=(date +%s) -v list="list" -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA" + return + end + + if set -q q[1] + set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA") + else + set target $HOME + end + if test "$status" -gt 0 + return + end + + if test -z "$target" + printf "'%s' did not match any results\n" "$argv" + return 1 + end + + if set -q _flag_echo + printf "%s\n" "$target" + else if set -q _flag_directory + if test -n "$ZO_METHOD" + type -q "$ZO_METHOD"; and "$ZO_METHOD" "$target"; and return $status + echo "Cannot open with ZO_METHOD set to $ZO_METHOD"; and return 1 + else if test "$OS" = Windows_NT + # Be careful, in msys2, explorer always return 1 + type -q explorer; and explorer "$target" + return 0 + echo "Cannot open file explorer" + return 1 + else + type -q xdg-open; and xdg-open "$target"; and return $status + type -q open; and open "$target"; and return $status + echo "Not sure how to open file manager"; and return 1 + end + else + pushd "$target" + end +end diff --git a/dot-config/fish/functions/__z_add.fish b/dot-config/fish/functions/__z_add.fish new file mode 100644 index 00000000..20d5d7e5 --- /dev/null +++ b/dot-config/fish/functions/__z_add.fish @@ -0,0 +1,49 @@ +function __z_add -d "Add PATH to .z file" + test -n "$fish_private_mode"; and return 0 + + for i in $Z_EXCLUDE + if string match -r $i $PWD >/dev/null + return 0 #Path excluded + end + end + + set -l tmpfile (mktemp $Z_DATA.XXXXXX) + + if test -f $tmpfile + set -l path (string replace --all \\ \\\\ $PWD) + command awk -v path=$path -v now=(date +%s) -F "|" ' + BEGIN { + rank[path] = 1 + time[path] = now + } + $2 >= 1 { + if( $1 == path ) { + rank[$1] = $2 + 1 + time[$1] = now + } + else { + rank[$1] = $2 + time[$1] = $3 + } + count += $2 + } + END { + if( count > 1000 ) { + for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging + } + else for( i in rank ) print i "|" rank[i] "|" time[i] + } + ' $Z_DATA 2>/dev/null >$tmpfile + + if test ! -z "$Z_OWNER" + chown $Z_OWNER:(id -ng $Z_OWNER) $tmpfile + end + # + # Don't use redirection here as it can lead to a race condition where $Z_DATA is clobbered. + # Note: There is a still a possible race condition where an old version of $Z_DATA is + # read by one instance of Fish before another instance of Fish writes its copy. + # + command mv $tmpfile $Z_DATA + or command rm $tmpfile + end +end diff --git a/dot-config/fish/functions/__z_clean.fish b/dot-config/fish/functions/__z_clean.fish new file mode 100644 index 00000000..ae1721a0 --- /dev/null +++ b/dot-config/fish/functions/__z_clean.fish @@ -0,0 +1,11 @@ +function __z_clean -d "Clean up .z file to remove paths no longer valid" + set -l tmpfile (mktemp $Z_DATA.XXXXXX) + + if test -f $tmpfile + while read line + set -l path (string split '|' $line)[1] + test -d $path; and echo $line + end <$Z_DATA >$tmpfile + command mv -f $tmpfile $Z_DATA + end +end diff --git a/dot-config/fish/functions/__z_complete.fish b/dot-config/fish/functions/__z_complete.fish new file mode 100644 index 00000000..a6264561 --- /dev/null +++ b/dot-config/fish/functions/__z_complete.fish @@ -0,0 +1,13 @@ +function __z_complete -d "add completions" + complete -c $Z_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k + complete -c $ZO_CMD -a "(__z -l | string replace -r '^\\S*\\s*' '')" -f -k + + complete -c $Z_CMD -s c -l clean -d "Cleans out $Z_DATA" + complete -c $Z_CMD -s e -l echo -d "Prints best match, no cd" + complete -c $Z_CMD -s l -l list -d "List matches, no cd" + complete -c $Z_CMD -s p -l purge -d "Purges $Z_DATA" + complete -c $Z_CMD -s r -l rank -d "Searches by rank, cd" + complete -c $Z_CMD -s t -l recent -d "Searches by recency, cd" + complete -c $Z_CMD -s h -l help -d "Print help" + complete -c $Z_CMD -s x -l delete -d "Removes the current directory from $Z_DATA" +end diff --git a/dot-config/fish/functions/fish_command_not_found.fish b/dot-config/fish/functions/fish_command_not_found.fish new file mode 100644 index 00000000..63706737 --- /dev/null +++ b/dot-config/fish/functions/fish_command_not_found.fish @@ -0,0 +1,59 @@ +function fish_command_not_found --description "Fish: suggest/install AUR pkg when command not found" + set -l cmd $argv + set -l pkgs + + printf '\033[0;31m\033[1m==> ERROR: Command not found:\033[0m %s\n' "$cmd" + printf '\033[0m' + printf 'Checking for package.' + + # spinner: print dots until pkgfile finishes + set -l spinner_pid + fish -c ' + while true + sleep 0.1 + printf "." + end + ' & + set spinner_pid $last_pid + + # query pkgfile; -b (binaries), -v (verbose) to include repo/pkg paths + set -l out (pkgfile -b -v -- "$cmd" ^/dev/null) + + # stop spinner + kill $spinner_pid 2>/dev/null + echo + + if test -n "$out" + # Split lines into array + set pkgs $out + + printf 'The application %s is not installed. It may be found in the following AUR packages:\n' "$cmd" + for p in $pkgs + printf ' %s\n' "$p" + end + + # Emulate original logic: take second field after splitting first match by "/" + # Example line format often like: "aur/pkgname usr/bin/cmd" + set -l first $pkgs[1] + set -l parts (string split -m1 ' ' -- $first)[1] + set -l repo_pkg (string split '/' -- $parts) + set -l pkgname $repo_pkg[2] + + if test -n "$pkgname" + printf 'Do you want to Install AUR package %s? (y/N) ' "$pkgname" + read -l -n 1 choice + echo + if test (string lower -- "$choice") = y + echo "Executing command: yay -S $pkgname" + yay -S "$pkgname" --noconfirm + echo + return + else + echo + return + end + end + end 1>&2 + + return 127 +end diff --git a/dot-config/fish/functions/fish_mode_prompt.fish b/dot-config/fish/functions/fish_mode_prompt.fish new file mode 100644 index 00000000..ace718c5 --- /dev/null +++ b/dot-config/fish/functions/fish_mode_prompt.fish @@ -0,0 +1,4 @@ +# Vi-mode +# The default mode prompt would be prefixed, which ruins our alignment. +function fish_mode_prompt +end diff --git a/dot-config/fish/functions/fish_prompt.fish b/dot-config/fish/functions/fish_prompt.fish new file mode 100644 index 00000000..be2b7e2e --- /dev/null +++ b/dot-config/fish/functions/fish_prompt.fish @@ -0,0 +1,131 @@ +function fish_prompt + # This prompt shows: + # - green lines if the last return command is OK, red otherwise + # - your user name, in red if root or yellow otherwise + # - your hostname, in cyan if ssh or blue otherwise + # - the current path (with prompt_pwd) + # - date +%X + # - the current virtual environment, if any + # - the current git status, if any, with fish_git_prompt + # - the current battery state, if any, and if your power cable is unplugged, and if you have "acpi" + # - current background jobs, if any + + # It goes from: + # ┬─[nim@Hattori:~]─[11:39:00] + # ╰─>$ echo here + + # To: + # ┬─[nim@Hattori:~/w/dashboard]─[11:37:14]─[V:django20]─[G:master↑1|●1✚1…1]─[B:85%, 05:41:42 remaining] + # │ 2 15054 0% arrêtée sleep 100000 + # │ 1 15048 0% arrêtée sleep 100000 + # ╰─>$ echo there + + set -l retc red + set -l prompt_status $status + test $prompt_status = 0; and set retc green + + set -q __fish_git_prompt_showupstream + or set -g __fish_git_prompt_showupstream auto + + function _nim_prompt_wrapper + set retc $argv[1] + set -l field_name $argv[2] + set -l field_value $argv[3] + + set_color normal + set_color $retc + echo -n '─' + set_color -o green + echo -n '[' + set_color normal + test -n $field_name + and echo -n $field_name: + set_color $retc + echo -n $field_value + set_color -o green + echo -n ']' + end + + set_color $retc + echo -n '┬─' + set_color -o green + echo -n [ + + if functions -q fish_is_root_user; and fish_is_root_user + set_color -o red + else + set_color -o yellow + end + + echo -n $USER + set_color -o white + echo -n @ + + if test -z "$SSH_CLIENT" + set_color -o blue + else + set_color -o cyan + end + + echo -n (prompt_hostname) + set_color -o white + echo -n :(prompt_pwd) + set_color -o green + echo -n ']' + + # Date + _nim_prompt_wrapper $retc '' (date +%X) + + if test "$fish_key_bindings" = fish_vi_key_bindings + or test "$fish_key_bindings" = fish_hybrid_key_bindings + set -l mode + switch $fish_bind_mode + case default + set mode (set_color --bold red)N + case insert + set mode (set_color --bold green)I + case replace_one + set mode (set_color --bold green)R + echo '[R]' + case replace + set mode (set_color --bold cyan)R + case visual + set mode (set_color --bold magenta)V + end + set mode $mode(set_color normal) + _nim_prompt_wrapper $retc '' $mode + end + + # Virtual Environment + set -q VIRTUAL_ENV_DISABLE_PROMPT + or set -g VIRTUAL_ENV_DISABLE_PROMPT true + set -q VIRTUAL_ENV + and _nim_prompt_wrapper $retc '' (path basename "$VIRTUAL_ENV") + + # git + set -l prompt_git (fish_git_prompt '%s') + test -n "$prompt_git" + and _nim_prompt_wrapper $retc '' $prompt_git + + test ! $prompt_status = 0; and _nim_prompt_wrapper $retc '' (fish_status_to_signal $prompt_status) + + # New line + echo + + # Background jobs + set_color normal + + for job in (jobs) + set_color $retc + echo -n '│ ' + set_color brown + echo $job + end + + set_color normal + set_color $retc + echo -n '╰─>' + set_color -o red + echo -n '$ ' + set_color normal +end diff --git a/dot-config/fish/functions/fish_user_key_bindings.fish b/dot-config/fish/functions/fish_user_key_bindings.fish new file mode 100644 index 00000000..df44927f --- /dev/null +++ b/dot-config/fish/functions/fish_user_key_bindings.fish @@ -0,0 +1,25 @@ +function fish_user_key_bindings + for m in default insert + bind -M $m ctrl-f accept-autosuggestion + bind -M $m ctrl-backspace backward-kill-word + end + + for m in default insert normal + bind -M $m alt-up 'commandline -f cancel; cd ..; commandline -f repaint' + bind -M $m ctrl-r history-pager + end + + bind -M normal U redo + + for m in default insert normal replace replace_one + bind --preset --erase -M $m ctrl-h + bind -M $m ctrl-h backward-char + bind --preset --erase -M $m ctrl-j + bind -M $m ctrl-j down-or-search + bind --preset --erase -M $m ctrl-k + bind -M $m ctrl-k up-or-search + # clear overrode + bind --preset --erase -M $m ctrl-l + bind -M $m ctrl-l forward-char + end +end diff --git a/dot-config/gtk-3.0/bookmarks b/dot-config/gtk-3.0/bookmarks index 7d108147..304a906f 100644 --- a/dot-config/gtk-3.0/bookmarks +++ b/dot-config/gtk-3.0/bookmarks @@ -5,7 +5,6 @@ file:///home/system/Pictures file:///home/system/Pictures/Screenshots file:///home/system/Nextcloud file:///home/system/Nextcloud/iCloud -file:///home/system/Code file:///home/system/Downloads file:///home/system/iCloud file:///home/system/.config/minecraft diff --git a/dot-config/helix/languages.toml b/dot-config/helix/languages.toml index 1bf54540..3435ec4d 100644 --- a/dot-config/helix/languages.toml +++ b/dot-config/helix/languages.toml @@ -29,26 +29,26 @@ args = ["--stdio"] [[language]] name = "git-commit" -language-servers = [ "scls", "gpt", "harper" ] +language-servers = [ "scls", "harper", "gpt"] [[language]] name = "cpp" auto-format = true indent = { tab-width = 4, unit = "t" } -language-servers = [ "scls", "clangd", "gpt", "harper" ] +language-servers = [ "scls", "clangd", "harper", "gpt" ] [[language]] name = "rust" auto-format = true indent = { tab-width = 4, unit = "t" } -language-servers = [ "scls", "rust-analyzer", "gpt", "harper" ] +language-servers = [ "scls", "rust-analyzer", "harper", "gpt" ] [language-server.rust-analyzer.config] check.command = "clippy" [[language]] name = "python" -language-servers = ["ty", "ruff", "jedi-language-server", "pyright", "pylsp", "gpt", "harper" ] +language-servers = ["ty", "ruff", "jedi-language-server", "pyright", "pylsp", "harper", "gpt" ] [[language]] name = "toml" @@ -57,12 +57,12 @@ auto-format = true [[language]] name = "markdown" -language-servers = [ "marksman", "mdpls", "markdown-oxide", "scls", "gpt", "harper" ] +language-servers = [ "marksman", "mdpls", "markdown-oxide", "scls", "harper", "gpt" ] auto-format = true [[language]] name = "java" -language-servers = [ "scls", "jdtls", "harper" ] +language-servers = [ "scls", "jdtls", "harper", "gpt" ] auto-format = true [[language]] diff --git a/dot-config/hypr/binds.conf b/dot-config/hypr/binds.conf index 905ddc35..a0a9f252 100644 --- a/dot-config/hypr/binds.conf +++ b/dot-config/hypr/binds.conf @@ -71,7 +71,8 @@ bind = ,XF86AudioNext, execr, playerctl position 5+ bindo = ,XF86AudioNext, execr, playerctl -p spotify next bind = ,XF86AudioPrev, execr, playerctl position 5- bindo = ,XF86AudioPrev, execr, playerctl -p spotify previous -bindl = ,XF86AudioPlay, exec, [workspace 7 silent; noinitialfocus] $HOME/scripts/play-pause.sh || LD_PRELOAD=/usr/lib64/spotify-adblock.so spotify +bindl = ,XF86AudioPlay, exec, [workspace 7 silent; noinitialfocus] playerctl -p spotify play-pause || LD_PRELOAD=/usr/lib64/spotify-adblock.so spotify +bindol = ,XF86AudioPlay, exec, [workspace 7 silent; noinitialfocus] playerctl --all-players pause || LD_PRELOAD=/usr/lib64/spotify-adblock.so spotify bind = ,XF86AudioStop, execr, playerctl -p spotify stop bind = ,XF86PowerOff, execr, $rofiexec/rofi_shutdown diff --git a/dot-config/hypr/rules.conf b/dot-config/hypr/rules.conf index 25e01a26..5f614c58 100644 --- a/dot-config/hypr/rules.conf +++ b/dot-config/hypr/rules.conf @@ -242,6 +242,9 @@ layerrule = ignorezero, waybar layerrule = blur, quickshell::bar layerrule = ignorezero, quickshell::bar +layerrule = blur, quickshell::CC +layerrule = ignorezero, quickshell::CC +layerrule = dimaround, quickshell::CC layerrule = blur, syshud layerrule = ignorezero, syshud diff --git a/dot-config/kitty/open-actions.conf b/dot-config/kitty/open-actions.conf new file mode 100644 index 00000000..a7c11ae1 --- /dev/null +++ b/dot-config/kitty/open-actions.conf @@ -0,0 +1,7 @@ +protocol file +fragment_matches [0-9]+ +action launch --type=overlay $EDITOR $FILE_PATH:$FRAGMENT + +protocol file +mime image/* +action launch kitten icat --hold $FILE_PATH diff --git a/dot-config/spicetify/config-xpui.ini b/dot-config/spicetify/config-xpui.ini index 61f765aa..5478f97a 100644 --- a/dot-config/spicetify/config-xpui.ini +++ b/dot-config/spicetify/config-xpui.ini @@ -29,4 +29,4 @@ expose_apis = 1 ; DO NOT CHANGE! [Backup] version = 1.2.63.394.g126b0d89 -with = 2.41.0 +with = 2.42.0 diff --git a/dot-config/wallust/templates/colors-kitty.conf b/dot-config/wallust/templates/colors-kitty.conf index 272d472b..ae97baa6 100644 --- a/dot-config/wallust/templates/colors-kitty.conf +++ b/dot-config/wallust/templates/colors-kitty.conf @@ -8,7 +8,7 @@ inactive_border_color {{background}} bell_border_color {{color1}} selection_foreground {{foreground}} -selection_background {{background}} +selection_background {{color4}} color0 {{color0}} color1 {{color1}} diff --git a/dot-config/wallust/templates/fish-colors.fish b/dot-config/wallust/templates/fish-colors.fish new file mode 100644 index 00000000..5ecaaf70 --- /dev/null +++ b/dot-config/wallust/templates/fish-colors.fish @@ -0,0 +1,55 @@ +# set -U wallpaper "{{wallpaper}}" + +set -U background '{{background}}' +set -U foreground '{{foreground}}' +set -U cursor '{{cursor}}' + +set -U color0 '{{color0}}' +set -U color1 '{{color1}}' +set -U color2 '{{color2}}' +set -U color3 '{{color3}}' +set -U color4 '{{color4}}' +set -U color5 '{{color5}}' +set -U color6 '{{color6}}' +set -U color7 '{{color7}}' +set -U color8 '{{color8}}' +set -U color9 '{{color9}}' +set -U color10 '{{color10}}' +set -U color11 '{{color11}}' +set -U color12 '{{color12}}' +set -U color13 '{{color13}}' +set -U color14 '{{color14}}' +set -U color15 '{{color15}}' + +set fish_color_normal normal +set fish_color_command {{color3.strip}} +set fish_color_param {{color11.strip}} +set fish_color_redirection $fish_color_param +set fish_color_comment {{color2.strip}} +set fish_color_error ff0000 +set fish_color_escape {{color1.strip}} +set fish_color_operator $fish_color_escape +set fish_color_end {{color1.strip}} +set fish_color_quote {{color2.strip}} +set fish_color_autosuggestion {{color8.strip}} +set fish_color_user {{color12.strip}} +set fish_color_host {{color4.strip}} +set fish_color_valid_path --underline +set fish_color_cwd {{color4.strip}} +set fish_color_cwd_root red +set fish_color_match --background=brblue +set fish_color_search_match bryellow --background=brblack +set fish_color_selection white --bold --background=brblack +set fish_color_cancel -r +set fish_pager_color_prefix white --bold --underline +set fish_pager_color_completion {{color15.strip}} --background={{color0.strip}} +set fish_pager_color_description $fish_color_quote yellow +set fish_pager_color_progress {{color6.strip}} --background={{color0.strip}} +set fish_color_history_current --bold + +# FZF colors +set -gx FZF_DEFAULT_OPTS " + $FZF_DEFAULT_OPTS + --color fg:7,bg:0,hl:1,fg+:232,bg+:1,hl+:255 + --color info:7,prompt:2,spinner:1,pointer:232,marker:1 +" diff --git a/dot-config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml b/dot-config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml index 11507799..d4dbc777 100644 --- a/dot-config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml +++ b/dot-config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml @@ -13,7 +13,7 @@ <property name="last-sort-order" type="string" value="GTK_SORT_DESCENDING"/> <property name="last-details-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_38_PERCENT"/> <property name="last-details-view-visible-columns" type="string" value="THUNAR_COLUMN_DATE_MODIFIED,THUNAR_COLUMN_NAME,THUNAR_COLUMN_SIZE,THUNAR_COLUMN_TYPE"/> - <property name="last-details-view-column-widths" type="string" value="50,50,133,127,50,194,50,50,1863,50,50,82,50,92"/> + <property name="last-details-view-column-widths" type="string" value="50,50,138,127,50,94,50,50,514,50,50,90,50,552"/> <property name="misc-status-bar-active-info" type="uint" value="31"/> <property name="misc-text-beside-icons" type="bool" value="false"/> <property name="misc-folders-first" type="bool" value="false"/> @@ -22,4 +22,5 @@ <property name="misc-show-delete-action" type="bool" value="true"/> <property name="last-restore-tabs" type="bool" value="false"/> <property name="misc-full-path-in-tab-title" type="bool" value="true"/> + <property name="last-menubar-visible" type="bool" value="true"/> </channel> |
