feat(zsh): add calculator

This commit is contained in:
thek4n 2024-05-23 16:03:27 +03:00
parent 906a276b5d
commit ed9c18f116
4 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ home/user/.config/bash/bashrc.d/*
!home/user/.config/bash/bashrc.d/.gitkeep !home/user/.config/bash/bashrc.d/.gitkeep
home/user/.config/zsh/zshrc.d/* home/user/.config/zsh/zshrc.d/*
!home/user/.config/zsh/zshrc.d/.gitkeep !home/user/.config/zsh/zshrc.d/.gitkeep
home/user/.config/zsh/.zcalc_history
*.zwc *.zwc

View File

@ -52,7 +52,6 @@ alias gensalt="dd if=/dev/urandom count=16 2>/dev/null | sha256sum | head -c 64"
alias diff='colordiff' alias diff='colordiff'
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .' alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man' alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man'
alias m='noglob ='
# time # time
alias now='date +"%T"' alias now='date +"%T"'

View File

@ -0,0 +1,10 @@
# calculator
autoload -U zcalc
function __calc {
zcalc -f -e "$*"
}
aliases[calc]='noglob __calc'
aliases[=]='noglob __calc'
# vim: ft=zsh

View File

@ -21,6 +21,8 @@ _so "$ZDOTDIR/aliases"
_so "$ZDOTDIR/plugin" _so "$ZDOTDIR/plugin"
_so "$ZDOTDIR/calculator"
bindkey '`' autosuggest-accept bindkey '`' autosuggest-accept
_sod "$ZDOTDIR/zshrc.d" _sod "$ZDOTDIR/zshrc.d"