Initial commit.

This commit is contained in:
CronyAkatsuki 2024-06-20 17:26:20 +02:00
commit fb9d04b7ef
28 changed files with 2359 additions and 0 deletions

3
.config/zsh/.zprofile Normal file
View file

@ -0,0 +1,3 @@
if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
exec startx
fi

56
.config/zsh/.zshenv Normal file
View file

@ -0,0 +1,56 @@
# Path setup
typeset -U PATH path
path=("$HOME/.local/bin" "$HOME/bin/dmenu" "$HOME/bin/misc" "$HOME/bin/statusbar" "$path[@]")
export PATH
# qt5ct setting
export QT_QPA_PLATFORMTHEME="qt6ct"
# Basic settings
export EDITOR="nvim"
export VISUAL="nvim"
export READER="zathura"
export TERMINAL="alacritty"
export BROWSER="qutebrowser"
export VIDEO="mpv"
export IMAGE="nsxiv"
export OPENER="xdg-open"
export PAGER="less"
export WM="xmonad"
export SUDO_ASKPASS="dmenu-pass"
# NNN settings
export NNN_FIFO="/tmp/nnn.fifo"
export NNN_PLUG="u:nmount;c:chksum;r:gitroot;v:imgview;m:mtpmount;d:xdgdefault;x:togglex;p:preview-tui"
export NNN_SSHFS="sshfs -o follow_symlinks"
export NNN_TERMINAL="alacritty --class preview,preview"
# Catppuccin colors nnn
BLK="03" CHR="03" DIR="04" EXE="02" REG="07" HARDLINK="05" SYMLINK="05" MISSING="08" ORPHAN="01" FIFO="06" SOCK="03" UNKNOWN="01"
export NNN_COLORS="#04020301;4231"
export NNN_FCOLORS="$BLK$CHR$DIR$EXE$REG$HARDLINK$SYMLINK$MISSING$ORPHAN$FIFO$SOCK$UNKNOWN"
# XDG CLEANUP
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DESKTOP_DIR="$HOME/.local/share/desktop"
export XDG_DOWNLOAD_DIR="$HOME/downs"
export XDG_TEMPLATES_DIR="$HOME/.local/share/templates"
export XDG_PUBLICSHARE_DIR="$HOME/.local/share/public"
export XDG_DOCUMENTS_DIR="$HOME/docs"
export XDG_MUSIC_DIR="$HOME/music"
export XDG_PICTURES_DIR="$HOME/pics"
export XDG_VIDEOS_DIR="$HOME/vids"
# Home cleanup
export CARGO_HOME="$XDG_DATA_HOME"/cargo
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
export GOPATH="$XDG_DATA_HOME"/go
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
export XCURSOR_PATH=/usr/share/icons:$XDG_DATA_HOME/icons
export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc

57
.config/zsh/.zshrc Normal file
View file

@ -0,0 +1,57 @@
# Nice prompt
eval "$(starship init zsh)"
# Quick folder jump
eval "$(zoxide init zsh)"
# Automatic setup of environments
eval "$(direnv hook zsh)"
# Plugin manager
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"
# Plugins
plug "zap-zsh/supercharge"
plug "xPMo/zsh-toggle-command-prefix"
plug "zap-zsh/completions"
plug "zap-zsh/vim"
plug "zap-zsh/exa"
plug "zsh-users/zsh-autosuggestions"
plug "zsh-users/zsh-completions"
plug "chivalryq/git-alias"
plug "zap-zsh/fzf"
plug "zdharma-continuum/fast-syntax-highlighting"
plug "zsh-users/zsh-history-substring-search"
plug "MichaelAquilina/zsh-you-should-use"
# Local
plug "$XDG_CONFIG_HOME/zsh/aliases.zsh"
plug "$XDG_CONFIG_HOME/zsh/functions.zsh"
# VI Mode escape timeout fix
export KEYTIMEOUT=1
# 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
# History settings
setopt INC_APPEND_HISTORY
export HISTTIMEFORMAT="[%F %T]"
HISTFILE="$HOME"/.local/state/zsh/history
# Add nnn shell level to prompt
[ -n "$NNNLVL" ] && PS1="N$NNNLVL $PS1"
# cd on nnn quiting
nnn_cd ()
{
if ! [ -z "$NNN_PIPE" ]; then
printf "%s\0" "0c${PWD}" > "${NNN_PIPE}" !&
fi
}
trap nnn_cd EXIT

37
.config/zsh/aliases.zsh Normal file
View file

@ -0,0 +1,37 @@
#!/bin/sh
# Check ssd state
alias ssd-check="sudo smartctl -a /dev/nvme0n1 | grep -E -- 'Data Units Read:|Data Units Written:|Percentage Used:'"
# Add colors to regular commands
alias grep='grep --color=auto'
alias cp='cp -iv'
alias rm='rm -iv'
alias mkd='mkdir -pv'
alias less='less -R'
# neovim
alias vi='nvim'
# nnn
alias nnn='LC_COLLATE="C" nnn -xeaiH'
# Human readable + better output
alias df='df -h -x devtmpfs -x tmpfs -x usbfs -x loop'
alias free='free -mht'
# nicer ps
alias ps='ps auxf'
# continue download by default
alias wget='wget -c'
# Just cause I can't remember the command at all
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"'
alias b='buku -p'
# cryptography
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"

69
.config/zsh/functions.zsh Normal file
View file

@ -0,0 +1,69 @@
#!/bin/sh
# 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="$2"
[ ! -d "$(dirname $to)" ] && mkdir -p "$(dirname $to)"
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() {
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"
}
# Copy current working directory
cpdir() {
pwd | tr -d "\r\n" | xclip -sel c
}
# Copy content of a file.
cf() {
cat $1 | xclip -sel c
}
# nnn
n () {
# Block nesting of nnn in subshells
[ "${NNNLVL:-0}" -eq 0 ] || {
echo "nnn is already running"
return
}
# Tempfile location
NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
nnn "$@"
[ ! -f "$NNN_TMPFILE" ] || {
. "$NNN_TMPFILE"
rm -f "$NNN_TMPFILE" > /dev/null
}
}
# upfast
upfast () {
curl -F "file=@$(readlink -f $1)" "https://upfast.cronyakatsuki.xyz/"
}