shfmt formatting

This commit is contained in:
Daylin Morgan 2022-01-18 12:29:42 -06:00
parent 38e4f299f5
commit 3361f81885
6 changed files with 57 additions and 62 deletions

View file

@ -50,9 +50,8 @@ alias vivaldi="vivaldi-stable"
#zellij #zellij
if is-exectuable zellij; then if is-exectuable zellij; then
alias zs="zellij -s" alias zs="zellij -s"
alias zl="zellij ls" alias zl="zellij ls"
alias za="zellij a" alias za="zellij a"
fi fi
########################################## ##########################################

View file

@ -2,22 +2,21 @@
# >>> conda initialize >>> # >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !! # !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$HOME/mambaforge/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" __conda_setup="$('$HOME/mambaforge/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
eval "$__conda_setup" eval "$__conda_setup"
else else
if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then
. "$HOME/mambaforge/etc/profile.d/conda.sh" . "$HOME/mambaforge/etc/profile.d/conda.sh"
else else
export PATH="$HOME/mambaforge/bin:$PATH" export PATH="$HOME/mambaforge/bin:$PATH"
fi fi
fi fi
unset __conda_setup unset __conda_setup
if [ -f "$HOME/mambaforge/etc/profile.d/mamba.sh" ]; then if [ -f "$HOME/mambaforge/etc/profile.d/mamba.sh" ]; then
. "$HOME/mambaforge/etc/profile.d/mamba.sh" . "$HOME/mambaforge/etc/profile.d/mamba.sh"
fi fi
# <<< conda initialize <<< # <<< conda initialize <<<
[ -d "$HOME/mambaforge/envs/dev" ] && conda activate dev [ -d "$HOME/mambaforge/envs/dev" ] && conda activate dev

View file

@ -1,9 +1,8 @@
# env variables # env variables
if ! [ $(cat /etc/hostname)=="thinkpad" ];then if ! [ $(cat /etc/hostname)=="thinkpad" ]; then
export BROWSER=/mnt/c/Users/daylin/AppData/Local/Vivaldi/Application/vivaldi.exe export BROWSER=/mnt/c/Users/daylin/AppData/Local/Vivaldi/Application/vivaldi.exe
else else
export BROWSER=vivaldi-stable export BROWSER=vivaldi-stable
fi fi
# aliases # aliases
alias files=explorer.exe alias files=explorer.exe

View file

@ -4,8 +4,8 @@ export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export PATH=$PATH:~/bin export PATH=$PATH:~/bin
export HISTSIZE=32768; export HISTSIZE=32768
export HISTFILESIZE="${HISTSIZE}"; export HISTFILESIZE="${HISTSIZE}"
export SAVEHIST=4096 export SAVEHIST=4096
export HISTCONTROL=ignoredups:erasedups export HISTCONTROL=ignoredups:erasedups
@ -30,11 +30,10 @@ fi
# setopt CORRECT # setopt CORRECT
# setopt CORRECT_ALL # setopt CORRECT_ALL
# Setup fzf # Setup fzf
# --------- # ---------
if [[ ! "$PATH" == *$HOME/.fzf/bin* ]]; then if [[ $PATH != *$HOME/.fzf/bin* ]]; then
export PATH="${PATH:+${PATH}:}$HOME/.fzf/bin" export PATH="${PATH:+${PATH}:}$HOME/.fzf/bin"
fi fi
if is-executable fzf; then if is-executable fzf; then
@ -54,7 +53,7 @@ fi
#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm #[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion #[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if is-executable fnm; then if is-executable fnm; then
eval "$(fnm env)" eval "$(fnm env)"
fi fi
# enhancd # enhancd

View file

@ -1,58 +1,58 @@
function cl() { function cl() {
DIR="$*"; DIR="$*"
# if no DIR given, go home # if no DIR given, go home
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
DIR=$HOME; DIR=$HOME
fi; fi
builtin cd "${DIR}" && \ builtin cd "${DIR}" &&
# use your preferred ls command # use your preferred ls command
ls -F --color=auto ls -F --color=auto
} }
prepend-path() { prepend-path() {
[ -d $1 ] && PATH="$1:$PATH" [ -d $1 ] && PATH="$1:$PATH"
} }
#delete and reclone remote repo #delete and reclone remote repo
reclone () { reclone() {
basename=${PWD##*/} basename=${PWD##*/}
remoteurl=$(git remote get-url --push origin) remoteurl=$(git remote get-url --push origin)
cd .. cd ..
echo $basename echo $basename
echo $remoteurl echo $remoteurl
rm -rf $basename rm -rf $basename
git clone $remoteurl git clone $remoteurl
cd $basename cd $basename
} }
# snakemake use all cores by default # snakemake use all cores by default
sm() { sm() {
if [[ "$*" == *"-j"* || "$*" == *"--jobs"* || "$*" == *"--cores"* ]]; then if [[ $* == *"-j"* || $* == *"--jobs"* || $* == *"--cores"* ]]; then
snakemake $@ snakemake $@
else else
snakemake -j all $@ snakemake -j all $@
fi fi
} }
function gi() { function gi() {
curl -sL "https://www.toptal.com/developers/gitignore/api/$@" ; curl -sL "https://www.toptal.com/developers/gitignore/api/$@"
}
# make pdfs or svgs from vegalite json's
mkvegapdf () {
vl2vg $1 | vg2pdf > $2
} }
mkvegasvg () { # make pdfs or svgs from vegalite json's
vl2vg $1 | vg2svg > $2 mkvegapdf() {
vl2vg $1 | vg2pdf >$2
}
mkvegasvg() {
vl2vg $1 | vg2svg >$2
} }
# quick and dirty pdf generation from simple md # quick and dirty pdf generation from simple md
md2pdf () { md2pdf() {
root=$1 root=$1
# get extension and root path: https://stackoverflow.com/a/40928328 # get extension and root path: https://stackoverflow.com/a/40928328
fname="${root#.}";fname="${root%"$fname"}${fname%.*}" fname="${root#.}"
fname="${root%"$fname"}${fname%.*}"
ext="${root#"$fname"}" ext="${root#"$fname"}"
echo "converting $root to pdf" echo "converting $root to pdf"
@ -66,7 +66,7 @@ md2pdf () {
} }
py2nb2html () { py2nb2html() {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "No arguments provided" echo "No arguments provided"
return 1 return 1
@ -77,8 +77,7 @@ py2nb2html () {
jupytext --to notebook -o - $pyfile | jupyter nbconvert --execute --to html --stdin $@ jupytext --to notebook -o - $pyfile | jupyter nbconvert --execute --to html --stdin $@
} }
web () { web() {
filepath=$(wslpath -w $1) filepath=$(wslpath -w $1)
$BROWSER $filepath $BROWSER $filepath
} }

View file

@ -26,8 +26,8 @@ PATH="$HOME/go/bin:$PATH"
# PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')" # PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')"
# printf %s "$PATH" | awk -v RS=: -v ORS=: '!arr[$0]++' # printf %s "$PATH" | awk -v RS=: -v ORS=: '!arr[$0]++'
PATH=$(printf %s "$PATH" \ PATH=$(printf %s "$PATH" |
| awk -vRS=: -vORS= '!a[$0]++ {if (NR>1) printf(":"); printf("%s", $0) }' ) awk -vRS=: -vORS= '!a[$0]++ {if (NR>1) printf(":"); printf("%s", $0) }')
# Wrap up # Wrap up
export PATH export PATH