sync zshrc with master
This commit is contained in:
parent
bf277af99e
commit
021d4cd327
116
.zshrc
116
.zshrc
|
@ -1,49 +1,118 @@
|
|||
### ENVVARS
|
||||
PATH="/usr/bin:/usr/sbin:$HOME/.local/bin:$HOME/.cargo/bin:/usr/local/bin:$HOME/.deno/bin"
|
||||
export PATH
|
||||
export EDITOR=nvim
|
||||
export editor=nvim
|
||||
export XDG_CONFIG_HOME=~/.config
|
||||
# zmodload zsh/zprof # for profiling, also uncomment last line
|
||||
|
||||
export TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
|
||||
export ZSH=$HOME/.zsh
|
||||
export CLIPBOARD_NOGUI=1 # wayland only allows GUI apps to use the clipboard.
|
||||
export CLIPBOARD_NOGUI=0 # wayland only allows GUI apps to use the clipboard.
|
||||
# cb would have to open every 2 seconds and steal
|
||||
# focus. This sucks, so I will have to disable GUI
|
||||
# integration (yes that means ctrl+v) for now.
|
||||
#
|
||||
# For wayland, set this to `1`
|
||||
# see https://github.com/Slackadays/Clipboard/issues/171
|
||||
export DATEFMT='+%a %Y-%m-%d %X'
|
||||
export EDITOR=nvim
|
||||
export VISUAL=nvim
|
||||
|
||||
|
||||
### Aliases
|
||||
alias l="ls -lah"
|
||||
alias ll="ls -lh"
|
||||
alias la="ls -a"
|
||||
alias l="ls -lah --date \"$DATEFMT\""
|
||||
alias ll="ls -lh --date \"$DATEFMT\""
|
||||
alias la="ls -a --date \"$DATEFMT\""
|
||||
alias ls="ls --date \"$DATEFMT\""
|
||||
alias grep="grep --color"
|
||||
alias egrep="grep -E"
|
||||
alias lgrep="find | grep"
|
||||
alias lagrep="find -exec realpath {} \; | grep"
|
||||
alias llgrep="find -type d -exec lsd -lah {} \;| grep"
|
||||
alias psgrep="ps axu | grep"
|
||||
alias plasmarestart="killall plasmashell; kstart5 plasmashell"
|
||||
alias isotime='date +"%Y-%m-%dT%H:%M:%S%z"'
|
||||
alias isodate='date +%Y-%m-%dT%H:%M:%S%z'
|
||||
alias datefmt='date $DATEFMT'
|
||||
alias gg=lazygit
|
||||
alias bat=batcat
|
||||
alias reload="source ~/.zshrc"
|
||||
alias gls=/bin/ls
|
||||
alias bat=batcat
|
||||
alias gotemp="cd $(mktemp -d)"
|
||||
alias dns=resolve
|
||||
alias open=xdg-open
|
||||
alias ipb="ip -brief"
|
||||
alias psa="ps -eadf"
|
||||
alias fsize="stat --printf='%s'"
|
||||
alias rg="rg --no-ignore"
|
||||
alias home="cd $HOME"
|
||||
alias ff=firefox
|
||||
alias fd=fdfind
|
||||
alias shutdown="confirm shutdown"
|
||||
|
||||
### Functions
|
||||
function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\s" }
|
||||
function midfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(M|G|T|P|E)\s" }
|
||||
function smallfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(B|K)\s" }
|
||||
function cachekeys () { exec 2>/dev/null;
|
||||
ssh-agent-start # see ~/.zprofile
|
||||
ssh-add
|
||||
}
|
||||
function newpass() {
|
||||
LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c${1:-$0}
|
||||
LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c${1:-40}
|
||||
}
|
||||
function condac() {
|
||||
conda activate $@
|
||||
export HOST=$(hostname)
|
||||
}
|
||||
function resolve() {
|
||||
dig +short $@
|
||||
# calculate on shell with `c 1+1`
|
||||
function c() { printf "%s\n" "$@" | bc -l; }
|
||||
# Call Python and execute multiple statements from args
|
||||
function py() {
|
||||
python <<< "
|
||||
from math import *
|
||||
|
||||
def evaluate_and_print(code):
|
||||
for expr in code.split(';'):
|
||||
expr = expr.strip()
|
||||
if '=' in expr:
|
||||
exec(expr)
|
||||
else:
|
||||
result = eval(expr)
|
||||
print(f\"{expr} => {result}\")
|
||||
|
||||
if __name__ == \"__main__\":
|
||||
expr = '$*'
|
||||
evaluate_and_print(expr)
|
||||
"
|
||||
}
|
||||
function countlines() {
|
||||
find . -type f -name "$1" -exec wc -l {} \; | awk '{print $0} {total += $1} END {print "Total lines:", total}'
|
||||
}
|
||||
function git-verify-commit () {
|
||||
git verify-commit $1
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "Commit is not signed."
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
function confirm() {
|
||||
echo "To be executed: $@"
|
||||
bash -c 'read -p "Confirm (Y/N): " -n 1 -r
|
||||
case "$REPLY" in
|
||||
y|Y ) echo "es"; eval $@;;
|
||||
n|N ) echo "o";;
|
||||
* ) echo -e "\ninvalid";;
|
||||
esac
|
||||
'
|
||||
}
|
||||
function confirm-important() {
|
||||
echo "Write 'yes do as i say' to confirm that you REALLY want to do this: $@"
|
||||
read
|
||||
if [[ "${REPLY,,}" = "yes do as i say" ]]
|
||||
then
|
||||
eval $@
|
||||
else
|
||||
echo "aborting"
|
||||
fi
|
||||
}
|
||||
|
||||
### ---- zsh options -------------------------------------
|
||||
|
@ -189,24 +258,6 @@ else
|
|||
eval "$(zoxide init zsh)"
|
||||
fi
|
||||
|
||||
### --- conda Config -------------------------------------
|
||||
# >>> conda initialize >>>
|
||||
# !! Contents within this block are managed by 'conda init' !!
|
||||
__conda_setup="$('/home/plex/.local/share/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "/home/plex/.local/share/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "/home/plex/.local/share/miniconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/home/plex/.local/share/miniconda3/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
# we don't want to see (base) constantly, so we do this:
|
||||
PS1=$(echo $PS1 | sed 's/(base) //') # remove base
|
||||
|
||||
### load unversioned zsh code
|
||||
if [ -f ~/.zsh.local ]; then
|
||||
source ~/.zsh.local
|
||||
|
@ -214,3 +265,4 @@ else
|
|||
touch ~/.zsh.local
|
||||
fi
|
||||
|
||||
# zprof
|
||||
|
|
Loading…
Reference in New Issue