.dotfiles/global/.zshrc
2025-02-17 09:56:00 +01:00

146 lines
3.9 KiB
Bash

# Path to your oh-my-zsh installation.
export TERM="tmux-256color"
export ZSH="$HOME/.oh-my-zsh"
setopt HIST_IGNORE_SPACE
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git python tmux genpass web-search zsh-syntax-highlighting zsh-autosuggestions poetry)
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
source $ZSH/oh-my-zsh.sh
# functions
### ARCHIVE EXTRACTION
# usage: ex <file>
ex ()
{
if [ -f "$1" ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
DIARY="default"
diary_string ()
{
"${HOME:?}/scripts/bin/diary.py" insert "${DIARY:?}" single "$*"
}
# aliases
## just
alias j="just"
## tmux
alias tsc='tmux switch-client -t'
alias tsd='tmux new-session -d -s'
alias txrd='tmux source-file ~/.tmux.conf'
## default command
alias cat='bat --paging=never --theme=Dracula'
alias ls="eza"
alias la="eza -lagh --git --header"
alias lt="eza -T --git-ignore"
#alias nano='micro'
## files/dirs
alias zshe='nvim ~/.zshrc'
alias zshs='. ~/.zshrc'
## neomutt
alias nm='neomutt'
## vim
# alias ovim='vim' # original vim
# alias diary='ovim ~/vimwiki/diary/diary.asc.md'
## nvim
alias vim='nvim'
alias evim='nvim ~/.dotfiles/global/.config/nvim/'
alias kvim='nvim ~/PKM/'
alias cvim='nvim ~/.zshrc'
alias tvim='nvim ~/Dropbox/TODO/'
alias kvimr='nvim ~/PKM/05\ -\ resources/'
alias kvimj='nvim ~/PKM/02\ -\ journal/'
alias jvim='nvim ~/PKM/02\ -\ journal/$(date "+%Y-%m-%d").md'
alias vi='nvim'
alias v='nvim'
## string
alias gen8='LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 8 | pbcopy'
## wttr.in
alias wr='curl wttr.in'
## python
alias python='python3'
alias py='python'
## todo.txt
alias todo="todo.sh -d ~/Dropbox/TODO/todo.cfg"
## eton
# alias et="eton"
# alias zk="eton zk"
# alias di=" eton diary"
## toipe (https://github.com/Samyak2/toipe)
alias to="toipe -f ~/Productivity/TextSync/typing_wordlists/most_problems"
## jrnl.sh
alias jrnl=" jrnl"
alias lj="jrnl -n 3 --format json | jq '.entries[].date'"
## jupyter
alias jup="jupyter lab"
## hledger
alias ledger='just -f ~/.hledger/justfile'
alias ehledger='nvim ~/.hledger/2024.journal'
## other
alias cclear="reset && tmux clear-history && cd"
## screenshots
alias scrn="screenshot.sh"
## secure deletion files
alias rrmm="shred -n 7 -z -u"
## secure deletion files in directory
alias frmm="find . -type f -exec shred -n 7 -z -u {} +"
## doomemacs
alias resmacs="killall emacs &> /dev/null && emacs --daemon &> /dev/null"
alias em="emacsclient -c"
alias relmacs="doom sync"
## diary
# alias di="diary.sh"
alias m2jrnl="diary.py export ${DIARY:?} diaryf"
alias dib="diary.py insert ${DIARY:?} bulk"
alias dis=" diary_string"
alias dit="diary.py doctor ${DIARY:?}"
alias jrnlc="jrnl --encrypt"
# bindkeys
## autosuggest
bindkey "^]" autosuggest-accept
# paths
## rust
if [[ -e "$HOME/.cargo/env" ]]; then
source $HOME/.cargo/env
fi
## fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source $HOME/.zshrc-additional
source $HOME/.zshrc-secrets