Basic updates.

This commit is contained in:
CronyAkatsuki 2023-08-23 19:51:32 +02:00
parent 08c122f3fd
commit a3bd316ea2
12 changed files with 352 additions and 152 deletions

View file

@ -2,13 +2,13 @@ export QT_QPA_PLATFORMTHEME=qt5ct
# Path exprt (.zshenv method doesn't work with gentoo for no real reason)
typeset -U PATH path
path=("$HOME/.local/bin" "$HOME/bin/dmenu/" "$HOME/bin/gaming/" "$HOME/bin/statusbar/" "$HOME/bin/misc/" "$HOME/bin/wayland" "$HOME/bin/fzf" "$HOME/bin/bspwm" "$path[@]")
path=("$HOME/.local/share/cargo/bin" "$HOME/.local/bin" "$HOME/bin/dmenu" "$HOME/bin/misc" "$HOME/bin/statusbar" "$HOME/bin/tmux" "$path[@]")
export PATH
export SXHKD_SHELL='/bin/sh'
[[ $(fgconsole 2>/dev/null) == 1 ]] && exec startx $HOME/.config/X11/xinitrc &> /dev/null
# [[ $(fgconsole 2>/dev/null) == 1 ]] && exec start-river &> /dev/null
# [[ $(fgconsole 2>/dev/null) == 1 ]] && exec start-dwl &> /dev/null
# [[ $(fgconsole 2>/dev/null) == 1 ]] && exec start-hyprland &> /dev/null
eval "$(ssh-agent -s)" &> /dev/null

View file

@ -16,7 +16,16 @@ plug "zap-zsh/completions"
plug "zap-zsh/vim"
plug "zsh-users/zsh-autosuggestions"
plug "zsh-users/zsh-completions"
plug "zsh-users/zsh-syntax-highlighting"
plug "chivalryq/git-alias"
plug "zdharma-continuum/fast-syntax-highlighting"
plug "zsh-users/zsh-history-substring-search"
plug "MichaelAquilina/zsh-you-should-use"
# Substring search settings
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold"
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold'
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Plugin settings
if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
@ -33,7 +42,16 @@ plug "$XDG_CONFIG_HOME/zsh/functions.zsh"
setopt appendhistory
setopt INC_APPEND_HISTORY
export HISTTIMEFORMAT="[%F %T]"
# HISTSIZE=10000
# SAVEHIST=5000
HISTFILE="$XDG_STATE_HOME"/zsh/history
[ -n "$NNNLVL" ] && PS1="N$NNNLVL $PS1"
nnn_cd ()
{
if ! [ -z "$NNN_PIPE" ]; then
printf "%s\0" "0c${PWD}" > "${NNN_PIPE}" !&
fi
}
trap nnn_cd EXIT

View file

@ -13,41 +13,19 @@ alias tree='tree -C'
alias less='less -R'
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"
# Git aliases
alias g='git'
alias gst='git status -s'
alias gc='git commit'
alias ga='git add'
alias gpl="git pull"
alias gpom="git pull origin master"
alias gpu="git push"
alias gpuom="git push origin master"
alias gd="git diff"
alias gch="git checkout"
alias gnb="git checkout -b"
alias gac="git add . && git commit"
alias grs="git restore --staged ."
alias gre="git restore"
alias gr="git remote"
alias gcl="git clone"
alias glg="git log --graph --abbrev-commit --decorate --format=format:'%C(bold green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
alias gt="git ls-tree -r master --name-only"
alias grm="git remote"
alias gb="git branch"
alias gf="git fetch"
# Easier to type
alias vi='nvim'
alias nnn='nnn -xec'
# Humna readable + better output
alias df='df -h -x devtmpfs -x tmpfs -x usbfs -x loop'
alias free='free -m -h'
# speed up
alias spotdl='spotdl --output-format ogg -p "{artist}/{album}/{artists} - {title}.{ext}" --dt 8 --st 8'
alias spotdl='spotdl --format mp3 --output "{artist}/{artists} - {title}" --threads 16 --sponsor-block'
# Just cause I can't remember the command at all
alias update-grub='doas grub-mkconfig -o /boot/grub/grub.cfg'
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
# Quickly see the hogger in the directory
alias dust='du -hd1 | sort -hr | sed "s/.\///g" | sed "/\.$/d"'
@ -59,10 +37,6 @@ alias ytvf='yt-dlp --merge-output-format mp4 --format best --embed-thumbnail --e
# Nice
alias dl='aria2c -j 16 -s 16 -x 16 -k 5M --file-allocation=none'
# ;)
alias lf='lfrun $@'
alias b='buku --suggest'
# cryptography

View file

@ -2,14 +2,21 @@
# Cd into a directory using fzf
fcd () {
dir=$(fd -a --type d --hidden --exclude ".git|.github" | fzf --prompt "Choose directory: ")
dir=$(fd -a --type d --hidden --exclude ".git|.github" --color=never | fzf --prompt "Choose directory: ")
[ -z $dir ] && return 1
cd $dir
}
# Cd into specific repo
fr () {
dir=$(fd . ~/repos --maxdepth 1 -a --type d --hidden --exclude ".git|.github" --color=never | 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: ")
remove=$(fd --hidden --maxdepth 1 --color=never | fzf -m --prompt "Choose to delete: ")
[ -z $remove ] && return 1
rm -rf $(printf '%s' $remove)
}
@ -33,6 +40,7 @@ md () {
mvln () {
from=$(readlink -f $1)
to=$(readlink -f $2)
[ ! -d "$(basename $to)" ] && mkdir "$to"
mv $from $to
ln -s $to $from
}
@ -45,13 +53,17 @@ se() {
# 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
current=$(pwd)
dir=$(fd . ~/.config -L --maxdepth 1 --color=never | fzf --prompt \
"Choose config to edit: " --preview 'tree -a -C {}')
[ "$dir" = "" ] && return
cd "$dir" && nvim .
cd "$current"
}
# 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: " \
fd -L --maxdepth 1 --type f --color=never --hidden | fzf --prompt "Choose file to edit: " \
--preview 'bat --color=always --style=plain --pager=never {}' | xargs -r $EDITOR
}
@ -84,3 +96,31 @@ erm() {
printf '%s\n' ""
done
}
# Check use flags of package in world
u() {
cat /var/lib/portage/world | fzf --prompt "Choose package to uninstall: " --preview "equery u {}" --multi
}
# Check dependencies of packages in world
d() {
cat /var/lib/portage/world | fzf --prompt "Choose package to uninstall: " --preview "emerge -pqe {}"
}
n () {
# Block nesting of nnn in subshells
[ "${NNNLVL:-0}" -eq 0 ] || {
echo "nnn is already running"
return
}
# Tempfile location
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
nnn "$@"
[ ! -f "$NNN_TMPFILE" ] || {
. "$NNN_TMPFILE"
rm -f "$NNN_TMPFILE" > /dev/null
}
}