104 lines
3.0 KiB
Bash
Executable File
104 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Adding colours to some of the regulas shit
|
|
alias grep='grep --color=auto'
|
|
alias ls='ls -Alh --color=always --group-directories-first'
|
|
alias tree='tree -C'
|
|
alias less='less -R'
|
|
|
|
# Humna readable + better output
|
|
alias df='df -h -x devtmpfs -x tmpfs -x usbfs -x loop'
|
|
alias free='free -m -h'
|
|
|
|
# Quickly see the hogger in the directory
|
|
alias dust='du -hd1 | sort -hr | sed "s/.\///g" | sed "/\.$/d"'
|
|
|
|
# Who want to remember this long ass commands
|
|
alias yta='yt-dlp -x -f bestaudio --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --audio-format vorbis -o "%(title)s.%(ext)s"'
|
|
alias ytvb='yt-dlp --merge-output-format mp4 -f "bestvideo+bestaudio[ext=m4a]/best" --embed-thumbnail --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --add-metadata -o "%(title)s.%(ext)s"'
|
|
alias ytvf='yt-dlp --merge-output-format mp4 --format best --embed-thumbnail --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --add-metadata -o "%(title)s.%(ext)s"'
|
|
|
|
# Nice
|
|
alias dl='aria2c -j 16 -s 16 -x 16 -k 5M --file-allocation=none'
|
|
|
|
# Functions
|
|
|
|
# Cd into a directory using fzf
|
|
fcd () {
|
|
dir=$(fd -a --type d --hidden --exclude ".git|.github" | fzf --prompt "Choose directory: ")
|
|
[ -z $dir ] && return 1
|
|
cd $dir
|
|
}
|
|
|
|
# Remove choosed stuff
|
|
frm () {
|
|
remove=$(fd --hidden --maxdepth 1 | fzf -m --prompt "Choose to delete: ")
|
|
[ -z $remove ] && return 1
|
|
rm -rf $(printf '%s' $remove)
|
|
}
|
|
|
|
# Quicly choose stuff to add using fzf
|
|
fga () {
|
|
git add $(git status -s | awk '{ print $2 }' | fzf -m)
|
|
}
|
|
|
|
# Open a script in path with vim quicly
|
|
vish () {
|
|
nvim $(which $1)
|
|
}
|
|
|
|
# Create a directory and change into it
|
|
md () {
|
|
mkdir -p "$@" && cd "$@"
|
|
}
|
|
|
|
# Move a file and create a link in it's place
|
|
mvln () {
|
|
from=$(readlink -f $1)
|
|
to=$(readlink -f $2)
|
|
mv $from $to
|
|
ln -s $to $from
|
|
}
|
|
|
|
# Find my script and let me edit them
|
|
se() {
|
|
fd . ~/bin -L --type f --color=never | fzf --prompt "Choose script to edit: " \
|
|
--preview 'bat --color=always --style=plain --pager=never {}' | xargs -r $EDITOR
|
|
}
|
|
|
|
# List my config and open the dir in a editor
|
|
ce() {
|
|
fd . ~/.config -L --maxdepth 1 --color=never | fzf --prompt \
|
|
"Choose config to edit: " --preview 'tree -a -C {}' | xargs -r $EDITOR
|
|
}
|
|
|
|
# List files in a directory and edit choosen one
|
|
vf(){
|
|
fd -L --maxdepth 1 --type f --color=never --hidden | fzf --prompt "Choose script to edit: " \
|
|
--preview 'bat --color=always --style=plain --pager=never {}' | xargs -r $EDITOR
|
|
}
|
|
|
|
# Install packages using paru
|
|
i() {
|
|
pkg list-all | fzf -q "$1" -m --preview 'pkg show {1}'| xargs -ro pkg install
|
|
}
|
|
# Remove installed packages
|
|
r() {
|
|
pkg list-installed | fzf -q "$1" -m --preview 'pkg show {1}' | xargs -ro pkg uninstall
|
|
}
|
|
|
|
# history search
|
|
h() {
|
|
print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed -E 's/ *[0-9]*\*? *//' | sed -E 's/\\/\\\\/g')
|
|
}
|
|
|
|
# Copy current working directory
|
|
cpdir() {
|
|
pwd | tr -d "\r\n" | xclip -sel c
|
|
}
|
|
|
|
# Copy content of a file.
|
|
cf() {
|
|
cat $1 | xclip -sel c
|
|
}
|