Files
fish-config/configs/alias_useful.fish
2026-02-03 12:31:43 +01:00

210 lines
5.9 KiB
Fish
Executable File

#
# In ~/.config/fish/configs/alias_useful.fish
#
################# STUFF YOU HAVE INSTALLED #####################################
alias remount='sudo mount -a'
alias mount_config='sudo nano /etc/fstab'
alias force_delete='sudo rm -rf' # Delete Folder/Files with included Folder/Files
alias own='sudo chown -R "$USER":"$USER" themes'
alias right='sudo chmod -R 755'
alias reload='clear && omf reload'
alias fish_config='nano $HOME/.config/fish/config.fish' # Open the fish Config in Text editor
alias ip 'ip -color'
alias psmem 'ps auxf | sort -nr -k 4'
alias psmem10 'ps auxf | sort -nr -k 4 | head -10'
alias jctl 'journalctl -p 3 -xb'
# Common use
alias ... 'cd ../..'
alias .... 'cd ../../..'
alias ..... 'cd ../../../..'
alias ...... 'cd ../../../../..'
alias dir 'dir --color=auto'
alias vdir 'vdir --color=auto'
alias tarnow 'tar -acf '
alias untar 'tar -zxvf '
################# HELPER #####################################################
function help_pdf
echo "Best Tool to combine pdf: PDF Arranger"
echo "Best Tool for OCR: OCRMYPDF but you need to install the teseracts for your languages"
echo "Best Tool to write in PDFs: XOURNAL++"
end
################# STUFF YOU MAY NOT HAVE #####################################
if test "$TERM" = "xterm-kitty"
alias icat='kitty +kitten icat'
end
if test -e /usr/bin/python3
alias python='python3'
alias py='python3'
end
# Easier Ollama Commands
if test -e /usr/bin/ollama
alias llama_start='ollama serve' # Start the LLama server
alias llama3='ollama run llama3' # Start the LLama Chat
end
if test -e /usr/bin/sudo-rs
alias sudo='sudo-rs'
end
if test -e /usr/bin/btop
alias tasks='btop'
end
if test -e /usr/bin/mpv
alias uni_play='mpv --vo=tct' # Plays a video in terminal with Unicode
alias asci_play='mpv --vo=caca' # Plays a video in terminal with ASCII
else
for cmd in uni_play asci_play
function $cmd
echo "You need to install mpv Inorder to use these commands: https://github.com/mpv-player/mpv"
end
end
end
function mkvenv
if not type -q python3
echo "Python3 is not installed. Please install Python3 to use mkvenv."
return 1
end
if not python3 -c "import venv" ^/dev/null
echo "Python3 'venv' module is not available. Please install it (e.g., 'python3-venv' on Debian/Ubuntu)."
return 1
end
if test (count $argv) -lt 1
echo "Usage: mkvenv {folder name}"
return 1
end
python3 -m venv $argv[1]
if test -f $argv[1]/bin/activate.fish
source $argv[1]/bin/activate.fish
else
echo "Error: Could not find activate.fish in $argv[1]/bin/"
return 1
end
end
# Check if eza exists in either location
if test -x /usr/bin/eza -o -x $HOME/.cargo/bin/eza
function ls
command eza -a --color=always --group-directories-first --icons $argv # Just more beautiful
end
function lr
command eza -al --color=always --group-directories-first --icons $argv # With rights and Owner
end
function ll
command eza -l --color=always --group-directories-first --icons $argv # Hidden Stuff is hidden
end
function lt
command eza -aT --color=always --group-directories-first --icons $argv # Tree View may take some time
end
function l.
command eza -ald --color=always --group-directories-first --icons .* $argv # Only Hidden Stuff
end
function lf
command eza -aD --color=always --group-directories-first --icons $argv # Only Folder
end
else
# Define dummy functions that remind user to install eza
for cmd in lr ll lt l. lf
function $cmd
echo "The command 'eza' is not installed. Please install 'eza' to use this: https://github.com/eza-community/eza"
end
end
end
if test -e /usr/bin/ugrep
alias grep 'ugrep --color=auto'
alias egrep 'ugrep -E --color=auto'
alias fgrep 'ugrep -F --color=auto'
else
for cmd in egrep fgrep
function $cmd
echo "The command 'ugrep' is not installed. Please install 'ugrep' to use this: https://github.com/Genivia/ugrep"
end
end
end
if test -e /usr/bin/wget
alias wget 'wget -c '
end
if test -e /usr/bin/ocrmypdf
alias ocrmypdf 'ocrmypdf --deskew --clean --rotate-pages'
else
alias ocrmypdf 'echo "The command 'ocrmypdf' is not installed. Please install 'ocrmypdf' to use this: https://github.com/ocrmypdf/OCRmyPDF"'
end
function rcp
if test (count $argv) -lt 2
echo "Usage: rcp SOURCE... DESTINATION"
return 1
end
rsync -avh --progress $argv
end
function rmv
if test (count $argv) -lt 2
echo "Usage: rmv SOURCE... DESTINATION"
return 1
end
rsync -avh --progress --remove-source-files $arg
end
function nanorm
if test (count $argv) -lt 1
echo "Usage: nanorm {FILE}"
return 1
end
set arg $argv[1]
if test -f $arg
rm $arg
end
nano $arg
end
if test -e /usr/bin/reflector
alias mirror='sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist'
alias mirrora='sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist'
alias mirrord='sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist'
alias mirrors='sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist'
end
if test -e $HOME/.config/sway/config
alias sway_config='nano $HOME/.config/sway/config' # Open the fish Config in Text editor
end
if test -e /usr/bin/yazi
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
end
else
function yazi
echo "The command 'yazi' is not installed. Please install 'yazi' to use this: https://github.com/sxyazi/yazi"
end
end