Skip to content

Instantly share code, notes, and snippets.

@ryo-ARAKI
Last active February 23, 2025 12:57
Show Gist options
  • Save ryo-ARAKI/9d5e85d7be10863d515850b2ce2182e3 to your computer and use it in GitHub Desktop.
Save ryo-ARAKI/9d5e85d7be10863d515850b2ce2182e3 to your computer and use it in GitHub Desktop.
# ~/.config/fish/config.fish
# prompt setting (using starfish)
starship init fish | source
# Add PATH to peco
set -x PATH $PATH /usr/bin
# cd for parent directories
abbr .. "cd .."
abbr ... "cd ../.."
abbr .... "cd ../../.."
# git
abbr g "git"
abbr ga "git add"
abbr gc "git commit"
abbr gcm 'git commit -m'
abbr gca "git commit --amend"
abbr gpsh "git push --set-upstream origin HEAD"
abbr gf "git fetch"
abbr gdif "git diff"
abbr gdh "git diff HEAD^...HEAD"
abbr gdc "git diff --cached"
abbr gchk "git checkout"
abbr gust "git restore --staged"
abbr gsav "git stash save -u"
abbr gp "git stash pop"
abbr gfp "git fetch && git pull"
abbr gls "git ls-files"
abbr glst "git stash list"
abbr gw "git switch"
abbr gb "git branch --sort=-committerdate"
abbr gba "git branch --all --sort=-committerdate"
## https://techracho.bpsinc.jp/jhonda/2018_12_13/66486
## https://yuu.1000quu.com/git_alias_and_zsh_setting
abbr gst "git status --short --branch"
### Show git log in compact form
abbr gl "git log --oneline --decorate=short --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cgreen%h %C(yellow)%cd %Cred%d %Creset%s %Cblue<%cn>' -10"
### Show git log with number of modified lines
abbr glli "git log --pretty=format:'%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]' --decorate --numstat -10"
### Show git log with visual graph of branch
abbr glgr "git log --graph --oneline --decorate=short --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cgreen%h %C(yellow)%cd %Cred%d %Creset%s %Cblue<%cn>'"
## latexdiff with git
abbr ldif "latexdiff-vc -e utf8 -t CFONT --flatten --git --force -r"
# dotfiles
abbr fishconfig "code ~/.config/fish/config.fish"
# apt
abbr aud "sudo apt-fast update"
abbr aug "sudo apt-fast upgrade"
abbr aui "sudo apt-fast install"
abbr aar "sudo apt-fast autoremove"
# For safety
alias cp "cp -i"
alias mv "mv -i"
alias rm "rm -i"
# ====================
# Rust re-implementation
# ====================
set rust_tools batcat fdfind dust eza procs rg sd
for tool in $rust_tools
if command -v $tool >/dev/null
switch $tool
case batcat
abbr cat "batcat"
case fdfind
abbr find "fdfind"
case dust
abbr du "dust"
case eza
abbr ls "eza"
abbr ltr "eza -l --sort new"
abbr lt "eza -l --sort old"
abbr lhs "eza -l --sort size"
abbr lhn "eza -l --sort name"
abbr ll "eza -ahl --git"
abbr lst "eza -T --git-ignore"
abbr lsd "eza -D"
abbr sl "eza"
abbr s "eza"
abbr l "eza"
abbr ks "eza"
case procs
abbr ps "procs"
case rg
abbr grep "rg"
case sd
abbr sed "sd"
end
end
end
# Expand tar.gz file as ./hoge.tar.gz
function extract
if test (count $argv) -eq 1
set filename (basename $argv[1] .tar.gz)
mkdir -p $filename && tar -xzf $argv[1] -C $filename
echo "Extracted to $filename/"
else
echo "Usage: extract <file.tar.gz>"
end
end
abbr gz "extract"
# rsync option
abbr rsync "rsync -artv"
# PDF Viewer
abbr ev "evince" # Default PDF viewer
abbr mp "mupdf" # minimal PDF viewer
# Surpress warnings
alias eog "eog 2>/dev/null"
alias vlc "vlc 2>/dev/null"
alias evince "evince 2>/dev/null"
# Other alias
alias c "echo 'Press Ctrl+l'" # Terminal clear
abbr cfree "free -h && sync && sudo sysctl vm.drop_caches=3 && free -h" # Cache clear
abbr bb "extractbb -O" # Output boundarybox information
abbr gs "gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -sOutputFile="
abbr projecteur "QT_QPA_PLATFORM=xcb projecteur" # Use projecteur with Wayland
alias mpiexecjl "/home/ryo/.julia/artifacts/e85c0a68e07fee0ee7b19c2abc210b1af2f4771a/bin/mpiexec"
# Greeting setting
set fish_greeting "Where there is a will, there is a way."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment