diff --git a/.bashrc b/.bashrc index fbd549d..ea304be 100644 --- a/.bashrc +++ b/.bashrc @@ -43,6 +43,7 @@ export PATH="/usr/texbin:$PATH" export PATH="$PATH:/Users/mochmann/.dotnet/tools" export PATH="/usr/local/opt/mysql@5.7/bin:$PATH" export PATH="/usr/local/opt/libpq/bin:$PATH" +export PATH="/usr/local/share/dotnet:$PATH" export CC=clang export CXX=clang++ export PATH="/usr/local/lib/python3.9/site-packages:$PATH" @@ -265,6 +266,31 @@ panpdf() { pandoc -w pdf -o "$folder/$name.pdf" "$folder/$file" } +# custom bash bultins +bash_plugin() { + input=$(history 1 | tr -s ' ' | cut -d " " -f 5) + prefix=${input:0:2} + + + if [[ "$prefix" == "0x" ]]; then + printf "%d\n" $input + echo -n "0b" + binary=$(printf "obase=2;%d\n" $input | bc) + echo -n "$binary" + history -d -1 + kill -INT $$ + elif [[ "$prefix" == "0b" ]]; then + value=${input:2} + decimal="$((2#$value))" + echo $decimal + printf "0x%x" $decimal + history -d -1 + kill -INT $$ + fi +} + +trap bash_plugin DEBUG + # ENVIRONMENT NPM_PACKAGES="${HOME}/.npm-packages" @@ -293,7 +319,7 @@ if [ -x /usr/local/bin/rbenv ] fi # ALIASES -alias ll="ls -lisa" +alias ll="ls -lisah" alias la="ls -A" alias l="ls -CF" alias histgrep='history | grep $@'