Move copy targets into directory; add tmux sessionizer

This commit is contained in:
david
2025-04-04 16:55:39 -05:00
parent bfc8c03bbe
commit f777f7632b
10 changed files with 81 additions and 13 deletions

View File

@ -0,0 +1 @@
print("print from init.lua file")

View File

@ -0,0 +1,27 @@
# set -g default-terminal "tmux-255color" # TODO: messes up backspace render, fix
set -s escape-time 0
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set -g status-style 'bg=#111111 fg=#22cc00'
set -g base-index 1
# vim-like movement stuff
set-window-option -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind -r ^ last-window
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# reload tmux.conf
bind r source-file "~/.config/tmux/tmux.conf" \; display-message "tmux.conf reloaded"
# use tmux-sessionizer in place of f find
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
# bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/personal/dev/todo.md"

View File

@ -0,0 +1,26 @@
# set env vars, path updates, etc
[[ -a $HOME/.rs-vars ]] \
&& source $HOME/.rs-vars \
&& export PATH=$PATH:$HOME/.rd/bin \
&& . /usr/local/opt/asdf/libexec/asdf.sh
# login shortcuts
alias assume="source assume"
alias login-bunk='aws sso login --profile'
alias login-bunk-id-list="grep sso_account_id $HOME/.aws/config"
alias login-pulumi-bunk='pulumi login '$PULUMI_LOGIN_TARGET'$(aws sts get-caller-identity --query Account --output text)'
# git stuff
alias git-push-to-develop='git branch -D develop; git checkout -b develop; git push origin develop -uf; git checkout -'
alias gpdev='git-push-to-develop'
# misc shortcuts
alias journal="cd $HOMEBOX; $EDITOR .current-journal"
alias kra="cd $HOMEBOX/process/kra; open .current_kra"
alias gll="cd $DEVDIR/git/lampo/gitlab"
alias bet='bundle exec rspec'
alias bel='bundle exec standardrb'
alias belr='bundle exec rubocop'
alias prt='poetry run pytest'
alias prl='poetry run black'

View File

@ -0,0 +1,7 @@
# life system shortcuts
alias life-system='cd ~/dbox/life/system; clear; ls'
alias goals='clear; sed -n 2,7p ~/dbox/life/system/direction/goals/current-goals.txt'
alias note='cd ~/dbox/life/system/tasks/inbox; vim'
alias todo='cd ~/dbox/life/system/tasks; vim +5 todo.txt'
alias budget="open ~/dbox/life/finance/budget/.current"

View File

@ -0,0 +1,10 @@
#!/bin/zsh
if [[ "$(pwd)" == $HOME || "$(pwd)" == $HOMEBOX ]]; then
clear
return
fi
tmux new-window -dn scratch
vim .
clear

View File

@ -0,0 +1,49 @@
#!/bin/zsh
switch_to() {
if [[ -z $TMUX ]]; then
tmux attach-session -t $1
else
tmux switch-client -t $1
fi
}
has_session() {
tmux list-sessions | grep -q "^$1:"
}
hydrate() {
if [ -f $2/.tmux-sessionizer ]; then
tmux send-keys -t $1 "source $2/.tmux-session-setup" c-M
elif [ -f $HOME/.tmux-sessionizer ]; then
tmux send-keys -t $1 "source $HOME/.tmux-session-setup" c-M
fi
}
if [[ $# -eq 1 ]]; then
selected=$1
else
# If someone wants to make this extensible, i'll accept
# PR
selected=$(find ~/ ~/personal ~/personal/dev/env/.config -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
hydrate $selected_name $selected
exit 0
fi
if ! has_session $selected_name; then
tmux new-session -ds $selected_name -c $selected
hydrate $selected_name $selected
fi
switch_to $selected_name

47
src_files/.zshrc Normal file
View File

@ -0,0 +1,47 @@
# use vim-like control in shell
set -o vi
# env vars
export EDITOR='nvim'
export HOMEBOX=$HOME'/dbox'
export DEVDIR=$HOME'/dev'
# path updates
export PATH=$HOME/.local/bin:$HOME/.local/scripts:$PATH
export PATH=$PATH:/opt/homebrew/opt/ccache/libexec
# executable name overrides
alias ls='ls -F'
alias vim='nvim'
# shortcuts for common commands
alias 3e='echo;echo;echo'
alias 12e='3e;3e;3e;3e'
alias cl='clear; '
alias cls='clear;ls'
# git stuff
alias gfo='git fetch origin'
alias gpo='git pull origin'
alias gfpo='git fetch origin; git pull origin'
# executable renames/paths
alias youtube-dl='youtube-dl --write-info-json'
# misc commands
alias pdt='ping -c 4 drinkingtea.net'
alias weather='curl wttr.in'
alias shrug='echo "¯\\_(ツ)_/¯"'
[[ -e $HOME/.profile ]] && source $HOME/.profile
# add machine-specific configs as appropriate
[[ -a $HOME/.config/zsh/.zshrc-life-system ]] \
&& source $HOME/.config/zsh/.zshrc-life-system
# TODO: refactor the below so that general dev is separate from rs specific stuff
[[ -a $HOME/.config/zsh/.zshrc-job-rs ]] \
&& source $HOME/.config/zsh/.zshrc-job-rs
alias lintjs='npx prettier --write'
export DEVKITARM=/opt/devkitpro/devkitARM
. /opt/homebrew/opt/asdf/libexec/asdf.sh # TODO: ensure not duplicated asdf logic