zshrc from work
This commit is contained in:
parent
b737c6a9cb
commit
77aa12bf56
60
.zshrc
60
.zshrc
|
@ -60,8 +60,28 @@ function condac() {
|
||||||
}
|
}
|
||||||
# calculate on shell with `c 1+1`
|
# calculate on shell with `c 1+1`
|
||||||
function c() { printf "%s\n" "$@" | bc -l; }
|
function c() { printf "%s\n" "$@" | bc -l; }
|
||||||
# call python in a print from args
|
# Call Python and execute multiple statements from args
|
||||||
function py() { python -c "from math import *; print($*)" }
|
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}'
|
||||||
|
}
|
||||||
|
|
||||||
### ---- zsh options -------------------------------------
|
### ---- zsh options -------------------------------------
|
||||||
setopt autocd
|
setopt autocd
|
||||||
|
@ -89,14 +109,6 @@ setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
setopt hist_ignore_space # ignore commands that start with space
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
setopt hist_verify # show command with history expansion to user before running it
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
|
||||||
### load unversioned zsh code
|
|
||||||
if [ -f ~/.zsh.local ]; then
|
|
||||||
source ~/.zsh.local
|
|
||||||
else
|
|
||||||
touch ~/.zsh.local
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
### --- Inputs Config ------------------------------------
|
### --- Inputs Config ------------------------------------
|
||||||
# vim keys, then override stuff.
|
# vim keys, then override stuff.
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
@ -188,11 +200,16 @@ fpath=($ZSH/plugins/zsh-completions/src $fpath)
|
||||||
|
|
||||||
ZAQ_PREFIXES+=('git commit( [^ ]##)# -[^ -]#m')
|
ZAQ_PREFIXES+=('git commit( [^ ]##)# -[^ -]#m')
|
||||||
ZAQ_PREFIXES_GREEDY+=('py #')
|
ZAQ_PREFIXES_GREEDY+=('py #')
|
||||||
|
ZAQ_PREFIXES_GREEDY+=('countlines #')
|
||||||
|
|
||||||
### --- fzf Config ------------------------------------
|
### --- fzf Config ------------------------------------
|
||||||
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
|
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
|
||||||
export FZF_CTRL_R_OPTS='--no-sort --exact'
|
export FZF_CTRL_R_OPTS='--no-sort --exact'
|
||||||
|
|
||||||
|
### --- nnn Config ------------------------------------
|
||||||
|
source ~/.local/share/nnn/quitcd/quitcd.bash_zsh
|
||||||
|
export NNN_PLUG='j:jump;z:autojump;'
|
||||||
|
|
||||||
### --- kitty Config ------------------------------------
|
### --- kitty Config ------------------------------------
|
||||||
# $KITTY_TERM is a custom envar I set in the kitty conf
|
# $KITTY_TERM is a custom envar I set in the kitty conf
|
||||||
# this stuff does not work nicely with tmux, just make them regular aliases. Shows an error if you use them in another terminal
|
# this stuff does not work nicely with tmux, just make them regular aliases. Shows an error if you use them in another terminal
|
||||||
|
@ -215,11 +232,20 @@ else
|
||||||
eval "$(zoxide init zsh)"
|
eval "$(zoxide init zsh)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### --- pyenv Config -------------------------------------
|
### load unversioned zsh code
|
||||||
if [ -d $HOME/.pyenv ]; then
|
if [ -f ~/.zsh.local ]; then
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
source ~/.zsh.local
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
else
|
||||||
eval "$(pyenv init -)"
|
touch ~/.zsh.local
|
||||||
eval "$(pyenv virtualenv-init - zsh)"
|
|
||||||
pyenv activate std 2> /dev/null > /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### --- pyenv Config -------------------------------------
|
||||||
|
export PYENV_ROOT="$HOME/.pyenv"
|
||||||
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||||
|
eval "$(pyenv init -)"
|
||||||
|
eval "$(pyenv virtualenv-init - zsh)"
|
||||||
|
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
fpath+=~/.zfunc
|
||||||
|
|
Loading…
Reference in New Issue