diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index adf65bc..18af81d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,3 +1,4 @@ +alias t="tmux a || tmux new-session -s janezicmatej -c ~" alias n=nvim_ve alias vim=nvim_ve @@ -11,16 +12,10 @@ alias accenton="defaults write -g ApplePressAndHoldEnabled -bool true" alias accentoff="defaults write -g ApplePressAndHoldEnabled -bool false" # docker -alias aafh=./helper +alias dps="docker ps --format table'{{ .ID }}\t{{ .Image }}\t{{ .Ports}}\t{{ .Names }}'" -# git -alias gcan="git commit -v --amend --no-edit" alias gros="git reset origin/$(git_current_branch) --soft" -# quick edit .dotfiles -alias zshrc="n $ZDOTDIR/.zshrc && source $ZDOTDIR/.zshrc" -alias addalias="n $ZDOTDIR/aliases.zsh && source $ZDOTDIR/.zshrc" - # unsorted alias ci="glab ci list" alias bm=batman diff --git a/zsh/scripts.zsh b/zsh/scripts.zsh index 3151fea..f36afdc 100644 --- a/zsh/scripts.zsh +++ b/zsh/scripts.zsh @@ -44,3 +44,39 @@ function nukepip { pip uninstall $(pip freeze) -y pip install -r $(pyenv root)/default-packages } + +function pyinit { + if [[ -f .python-version ]]; then + echo "found .python-version, stopping" + return + fi + + DIRNAME=$(basename "$PWD") + + if [[ $(pyenv versions | grep "$DIRNAME") ]]; then + echo "found existing version with this name, setting..." + pyenv local "$DIRNAME" + return + fi + + if [[ -z $1 ]]; then + echo "no python version provided, defaulting to $(pyenv version-name)" + VERSION=$(pyenv version-name) + else + VERSION=$1 + fi + + pyenv virtualenv "$VERSION" "$DIRNAME" + pyenv local "$DIRNAME" + +} + +function lh { + if [[ -z $1 ]]; then + PORT=8000 + else + PORT=$1 + fi + + open "http://localhost:$PORT" +}