fixed a lot of stuff

This commit is contained in:
Honney
2026-06-23 00:23:16 +02:00
parent 74f4b9b1be
commit 6591f6b020
24 changed files with 626 additions and 455 deletions
+212 -189
View File
@@ -2,223 +2,259 @@
# In ~/.config/fish/configs/alias_useful.fish
#
################# STUFF YOU HAVE INSTALLED #####################################
################ COMMON ALIASES ################################################
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 own='sudo chown -R "$USER":"$USER"'
alias right='sudo chmod -R 755'
alias reload='clear && omf reload'
alias fish_config='nano $HOME/.config/fish/config.fish'
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'
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'
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 #####################################################
################ HELPERS ######################################################
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 for OCR: OCRMYPDF but you need to install the tesseracts for your languages"
echo "Best Tool to write in PDFs: XOURNAL++"
end
################# STUFF YOU MAY NOT HAVE #####################################
if test -e /usr/bin/rsync
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 $argv
end
else
function rcp
echo "'rsync' is not installed. Install it via your package manager."
end
function rmv
echo "'rsync' is not installed. Install it via your package manager."
end
end
if test -e /usr/bin/nano
function nanorm
if test (count $argv) -lt 1
echo "Usage: nanorm {FILE}"
return 1
end
nano $argv[1]
end
else
function nanorm
echo "'nano' is not installed. Install it via your package manager."
end
end
function source --description "Source files with auto-detection (replaces builtin source)"
if test (count $argv) -eq 0
builtin source
return
end
set file $argv[1]
set -e argv[1]
if string match -q -- "--*" $file
builtin source $file $argv
return
end
if not test -f "$file"
echo "source: No such file: '$file'" >&2
return 1
end
if string match -q "*.bash" -- $file
if command -q bass
bass source $file $argv
else
echo "source: 'bass' is not installed. Install it to source .bash files." >&2
return 1
end
else
builtin source $file $argv
end
end
################ TERMINAL-SPECIFIC ############################################
if test "$TERM" = "xterm-kitty"
alias icat='kitty +kitten icat'
end
################ PYTHON #######################################################
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/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"
if test -e /usr/bin/python3
function mkvenv
if not python3 -c "import venv" ^/dev/null
echo "Python3 'venv' module is not available. Install python3-venv via your package manager."
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
end
function mkvenv
if not type -q python3
else
function mkvenv
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
function src
# Check if venv directory exists
if not test -d .venv
echo "Cannot activate: .venv directory does not exist."
if test -e /usr/bin/python3
function src
if not test -d .venv
echo "Cannot activate: .venv directory does not exist."
return 1
end
if not test -d .venv/bin
echo "Cannot activate: .venv/bin directory does not exist."
return 1
end
if test -f .venv/bin/activate.fish
source .venv/bin/activate.fish
return 0
end
if test -f .venv/bin/activate.bash
if test -e /usr/bin/bass
bass source .venv/bin/activate.bash
return 0
else
echo "'bass' is not installed. Install it via your package manager to source bash scripts."
return 1
end
end
echo "No usable activation script found in .venv/bin/"
return 1
end
if not test -d .venv/bin
echo "Cannot activate: .venv/bin directory does not exist."
return 1
end
# Prefer Fish activation script
if test -f .venv/bin/activate.fish
source .venv/bin/activate.fish
return 0
end
# Fallback to bash activation via bass
if test -f .venv/bin/activate.bash
bass source .venv/bin/activate.bash
return 0
end
echo "No usable activation script found in .venv/bin/"
return 1
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
function src
echo "Python3 is not installed. Please install Python3 to use src."
end
end
################ OLLAMA ######################################################
if test -e /usr/bin/ollama
alias llama_start='ollama serve'
alias llama3='ollama run llama3'
end
################ EZA ##########################################################
if test -x /usr/bin/eza
function ls
command eza -a --color=always --group-directories-first --icons $argv
end
function lr
command eza -al --color=always --group-directories-first --icons $argv
end
function ll
command eza -l --color=always --group-directories-first --icons $argv
end
function lt
command eza -aT --color=always --group-directories-first --icons $argv
end
function l.
command eza -ald --color=always --group-directories-first --icons .* $argv
end
function lf
command eza -aD --color=always --group-directories-first --icons $argv
end
else
for cmd in lr ll lt l. lf
function $cmd
function $cmd --inherit-variable 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'
################ BTOP #########################################################
if test -e /usr/bin/btop
alias tasks='btop'
end
################ MPV ##########################################################
if test -e /usr/bin/mpv
alias uni_play='mpv --vo=tct'
alias asci_play='mpv --vo=caca'
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"
for cmd in uni_play asci_play
function $cmd --inherit-variable cmd
echo "The command 'mpv' is not installed. Please install mpv to use this: https://github.com/mpv-player/mpv"
end
end
end
if test -e /usr/bin/wget
alias wget 'wget -c '
################ GREP #########################################################
if test -e /usr/bin/ugrep
alias grep='ugrep --color=auto'
alias egrep='ugrep -E --color=auto'
alias fgrep='ugrep -F --color=auto'
else
alias egrep='grep -E'
alias fgrep='grep -F'
end
################ WGET #########################################################
if test -e /usr/bin/wget
alias wget='wget -c'
end
################ OCRMYPDF #####################################################
if test -e /usr/bin/ocrmypdf
alias ocrmypdf 'ocrmypdf --deskew --clean --rotate-pages'
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
function ocrmypdf
echo "The command 'ocrmypdf' is not installed. Install it via your package manager: https://github.com/ocrmypdf/OCRmyPDF"
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
################ YAZI #########################################################
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 -o -e /usr/local/bin/yazi
if test -e /usr/bin/yazi
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
@@ -228,15 +264,21 @@ if test -e /usr/bin/yazi -o -e /usr/local/bin/yazi
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"
for cmd in yazi y
function $cmd --inherit-variable cmd
echo "The command 'yazi' is not installed. Please install 'yazi' to use this: https://github.com/sxyazi/yazi"
end
end
end
################ SUDO #########################################################
if test -e /usr/bin/sudo-rs
alias sudo=sudo-rs
end
################ FLASH ISO ####################################################
if test -e /usr/bin/dd
function flashiso --description "Flash an ISO to a target drive with dd"
if test (count $argv) -ne 2
@@ -244,25 +286,6 @@ if test -e /usr/bin/dd
echo "Example: flashiso ubuntu-25.10-desktop-amd64.iso /dev/sdb"
return 1
end
set iso $argv[1]
set drive $argv[2]
sudo dd if=$iso of=$drive bs=4M status=progress oflag=sync
end
end
#### SOURCE of bash
function smart_source
set file $argv[1]
if string match -q "*.bash" -- $file
bass source $file
else if string match -q "*.fish" -- $file
builtin source $file
else
# fallback: try fish source by default
builtin source $file
sudo dd if=$argv[1] of=$argv[2] bs=4M status=progress oflag=sync
end
end