Add system-type filters, add git-clone handling to main script
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
defaultBranch = master
|
||||
[user]
|
||||
name = david
|
||||
email = david@silverwolf.studio
|
||||
email = placeholder
|
||||
|
@@ -1,10 +1,10 @@
|
||||
local omitted_dirs=(
|
||||
tmux_omitted_dirs=(
|
||||
$HOME
|
||||
$DIR_HOME_BOX
|
||||
$DIR_DEV
|
||||
$DIR_GIT_PROJECTS
|
||||
)
|
||||
[[ ! ${omitted_dirs[(re)$(pwd)]} ]] &&
|
||||
[[ ! ${tmux_omitted_dirs[(re)$(pwd)]} ]] &&
|
||||
tmux new-window -d -n cmd &&
|
||||
tmux rename-window $EDITOR &&
|
||||
$EDITOR .
|
||||
|
@@ -7,8 +7,8 @@ export DIR_HOME_BOX="$HOME/dbox"
|
||||
export DIR_MUSIC="$DIR_HOME_BOX/media/music"
|
||||
export DIR_DEV="$HOME/dev"
|
||||
export DIR_GIT_PROJECTS="$DIR_DEV/git"
|
||||
export DIR_SCRATCH_NOTES="$DIR_HOME_BOX/life/scratchpad/notes"
|
||||
export DIR_SCRATCH_DRAWINGS="$DIR_HOME_BOX/life/scratchpad/drawings"
|
||||
export DIR_SCRATCH_NOTES="$DIR_HOME_BOX/scratchpad/notes"
|
||||
export DIR_SCRATCH_DRAWINGS="$DIR_HOME_BOX/scratchpad/drawings"
|
||||
|
||||
# util dirs; do not change without checking impact on xdg base dirs
|
||||
export DIR_LOCAL="$HOME/.local"
|
||||
|
@@ -16,9 +16,8 @@ alias nv='nvim'
|
||||
alias n='nvim'
|
||||
alias tms='tmux-session-init'
|
||||
|
||||
# executable name overrides
|
||||
# executable overrides
|
||||
alias ls='ls -F'
|
||||
alias yt-dlp='yt-dlp --write-info-json'
|
||||
|
||||
# misc commands
|
||||
alias cal='khal calendar'
|
||||
|
@@ -11,7 +11,7 @@ alias gfo='git fetch origin'
|
||||
alias git-push-to-temp='git branch -D temp; git checkout -b temp; git push origin temp -uf; git checkout -'
|
||||
alias gpdev='git-push-to-temp'
|
||||
alias gpo='git pull origin'
|
||||
git config --global user.email "$EMAIL_PERSONAL_DEV"
|
||||
git config --global user.email "$EMAIL_PERSONAL_DEV" # TODO: maybe fit this into system-type filters?
|
||||
|
||||
# code/test/linter run and build commands
|
||||
alias bel='bundle exec standardrb'
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/bin/zsh
|
||||
|
||||
local target_dir=$(dirname "${@: -1}")
|
||||
[[ ! -d "$target_dir" ]] && mkdir -p "$target_dir"
|
||||
mvd_target_dir=$(dirname "${@: -1}")
|
||||
[[ ! -d "$mvd_target_dir" ]] && mkdir -p "$mvd_target_dir"
|
||||
exec mv "$@"
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#!/bin/zsh
|
||||
|
||||
switch_to() {
|
||||
tmux_switch_to() {
|
||||
[[ -z $TMUX ]] && tmux attach-session -t $1 || tmux switch-client -t $1
|
||||
}
|
||||
|
||||
hydrate() {
|
||||
tmux_hydrate() {
|
||||
local tmux_hydrate_files_dir="$XDG_CONFIG_HOME/tmux/session-hydrate-files"
|
||||
local tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-default"
|
||||
[[ $1 = "thinking" ]] && tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-thinking"
|
||||
@@ -13,28 +13,28 @@ hydrate() {
|
||||
[[ -f $tmux_hydrate_path ]] && tmux send-keys -t $1 "source $tmux_hydrate_path" c-M
|
||||
}
|
||||
|
||||
local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions || echo '')
|
||||
local search_dirs=(
|
||||
tmux_existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions || echo '')
|
||||
tmux_search_dirs=(
|
||||
$DIR_HOME_BOX
|
||||
$DIR_DEV
|
||||
$DIR_GIT_PROJECTS/*
|
||||
)
|
||||
local target_name=''
|
||||
local target_path=''
|
||||
tmux_target_name=''
|
||||
tmux_target_path=''
|
||||
|
||||
[[ $# -eq 1 ]] && target_path=$1 ||
|
||||
target_path=$(find $search_dirs -mindepth 1 -maxdepth 1 -type d | fzf)
|
||||
[[ $# -eq 1 ]] && tmux_target_path=$1 ||
|
||||
tmux_target_path=$(find $tmux_search_dirs -mindepth 1 -maxdepth 1 -type d | fzf)
|
||||
|
||||
if [[ $target_path = "." ]]; then target_name=$(basename $(pwd)) && target_path=$(pwd);
|
||||
elif [[ $target_path = "hub" ]]; then target_name="hub" && target_path="$HOME";
|
||||
elif [[ $target_path = "thinking" ]]; then target_name="thinking" && target_path="$DIR_SCRATCH_NOTES";
|
||||
elif [[ $target_path = "listening" ]]; then target_name="listening" && target_path="$DIR_MUSIC";
|
||||
elif [[ -n $target_path ]]; then target_name=$(basename "$target_path" | tr . _);
|
||||
if [[ $tmux_target_path = "." ]]; then tmux_target_name=$(basename $(pwd)) && tmux_target_path=$(pwd);
|
||||
elif [[ $tmux_target_path = "hub" ]]; then tmux_target_name="hub" && tmux_target_path="$HOME";
|
||||
elif [[ $tmux_target_path = "thinking" ]]; then tmux_target_name="thinking" && tmux_target_path="$DIR_SCRATCH_NOTES";
|
||||
elif [[ $tmux_target_path = "listening" ]]; then tmux_target_name="listening" && tmux_target_path="$DIR_MUSIC";
|
||||
elif [[ -n $tmux_target_path ]]; then tmux_target_name=$(basename "$tmux_target_path" | tr . _);
|
||||
fi
|
||||
|
||||
[[ -z $target_name ]] && exit 0
|
||||
[[ -z $tmux_target_name ]] && exit 0
|
||||
|
||||
! (echo $existing_sessions | grep -q "$target_name") &&
|
||||
tmux new-session -d -s $target_name -c $target_path &&
|
||||
hydrate $target_name $target_path
|
||||
switch_to $target_name
|
||||
! (echo $tmux_existing_sessions | grep -q "$tmux_target_name") &&
|
||||
tmux new-session -d -s $tmux_target_name -c $tmux_target_path &&
|
||||
tmux_hydrate $tmux_target_name $tmux_target_path
|
||||
tmux_switch_to $tmux_target_name
|
||||
|
Reference in New Issue
Block a user