84 lines
2.0 KiB
Bash
Executable File
84 lines
2.0 KiB
Bash
Executable File
#!/bin/zsh
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
export PATH="/Applications/ARM/bin:$PATH"
|
|
|
|
alias ls="ls --color=auto"
|
|
alias bashcols="python3 ~/cloud/Projekt/Programmering/Python/BashCols.py"
|
|
alias bashcurmov="python3 ~/cloud/Projekt/Programmering/Python/Bashcurmoves.py"
|
|
alias objdump="objdump -M intel"
|
|
alias atsc="patscc -cleanaft -DATS_MEMALLOC_LIBC"
|
|
alias i2="idris2"
|
|
alias py="python"
|
|
alias ipy="ipython"
|
|
alias c="cargo"
|
|
alias bqn="rlwrap BQN"
|
|
alias nix-zsh="nix-shell --run zsh"
|
|
alias z=nix-zsh
|
|
|
|
_BLUE="\033[38;5;4m"
|
|
_GREEN="\033[38;5;2m"
|
|
_RED="\033[38;5;1m"
|
|
_RESET="\033[0m"
|
|
function activate {
|
|
(
|
|
cd ~/cloud/Projekt
|
|
F=$( fd '' -t d -d 4 . | fzf -1 -q "$1" ) || return
|
|
LINKEE=$(realpath "$F")
|
|
DEFAULT_NAME=$(basename "$LINKEE")
|
|
LINK="${2:-${DEFAULT_NAME}}"
|
|
cd ~/cloud/A-Aktivta
|
|
if [[ -d "$LINK" ]] then
|
|
echo "Project ${_BLUE}$LINK${_RESET} already exists!"
|
|
else
|
|
echo "${_BLUE}$LINK${_RESET} -> ${_BLUE}$LINKEE${_RESET} has been ${_GREEN}activated${_RESET}"
|
|
ln -s "$LINKEE" "$LINK"
|
|
fi
|
|
)
|
|
_check_proj_count
|
|
}
|
|
|
|
function _check_proj_count {
|
|
(
|
|
cd ~/cloud/A-Aktivta
|
|
N_FILES=$(ls | wc -l | tr -d ' ')
|
|
if [[ $N_FILES > 4 ]] then
|
|
echo "You have $_RED$N_FILES$_RESET active projets. Consider deactivating some"
|
|
fi
|
|
)
|
|
}
|
|
|
|
function deactivate {
|
|
(
|
|
cd ~/cloud/A-Aktivta
|
|
F=$( fd '' -t l -d 1 . | fzf -1 -q "$1" ) || return
|
|
rm "$F"
|
|
echo "Deactivated $_BLUE$F$RESET"
|
|
)
|
|
_check_proj_count
|
|
}
|
|
|
|
function project {
|
|
pushd >/dev/null
|
|
cd ~/cloud/A-Aktivta
|
|
PROJ_NAME=$( fd '' -t l -d 1 . | fzf -1 -q "$1" ) || { popd >/dev/null ; return }
|
|
F=$(realpath "$PROJ_NAME")
|
|
|
|
echo "In $_BLUE${PROJ_NAME}$_RESET"
|
|
cd "$F"
|
|
_check_proj_count
|
|
}
|
|
|
|
alias p=project
|
|
|
|
setopt prompt_subst
|
|
|
|
# export RPROMPT='%(?.%F{green}√.%?%F{red}?)%f'
|
|
|
|
# tmux stuff
|
|
function setwd {
|
|
tmux command-prompt -I "attach -c $(pwd)"
|
|
}
|
|
|
|
alias nix-zsh="nix-shell --run zsh"
|