1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2026-05-08 05:21:36 +02:00

Zsh: Added widgets for mkcd and improved uv init

This commit is contained in:
2026-05-06 03:44:20 +02:00
parent 637edf2e96
commit 0aab087f11
2 changed files with 30 additions and 17 deletions

View File

@@ -85,12 +85,40 @@ function +vi-git-stash() {
# CUSTOM WIDGETS #
##################
mkcd() {
mkdir -p -- "$1" &&
cd -- "$1"
}
uv() {
if [[ "$1" == "init" ]]; then
shift
if [[ "$1" == "--normal" ]]; then
shift
command uv init "$@"
else
command uv init --bare "$@" || return
if [[ $# -eq 0 ]]; then
command uv venv || return
if [[ -f ".venv/bin/activate" ]]; then
source .venv/bin/activate
fi
fi
fi
else
command uv "$@"
fi
}
_find_venv_upwards() {
local dir="$PWD"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/pyvenv.cfg" ]]; then
echo "$dir"
if [[ -f "$dir/.venv/pyvenv.cfg" ]]; then
echo "$dir/.venv"
return
fi
dir=$(dirname "$dir")
@@ -314,9 +342,6 @@ fi
# thefuck
eval $(thefuck --alias)
# python
eval "$(pyenv init -)"
# opam
[[ ! -r "$HOME/.opam/opam-init/init.zsh" ]] || source "$HOME/.opam/opam-init/init.zsh" > /dev/null 2> /dev/null