Update .zshrc and refactor related files as needed

This commit is contained in:
david 2025-04-04 16:55:39 -05:00
parent a277b12884
commit 5f59b4f86d
12 changed files with 54 additions and 44 deletions

View File

@ -1,12 +1,13 @@
# repo containing configs and scripts to set up a box # repo containing configs and scripts to set up a box
### prerequisites ### prerequisites
- install git if not already installed - zsh is installed (scripts are written for zsh)
- clone this repo - git is installed
- if on macOS, install [homebrew](https://brew.sh/)
- export the env var `BOX_SETUP_OS` to indicate the operating system - export the env var `BOX_SETUP_OS` to indicate the operating system
- (options defined in `set_env_vars` file) - options defined in `set_env_vars` file
- if on macOS, install [homebrew](https://brew.sh/)
### script run ### script run
- git clone this repo
- from the repo's root directory, run `./setup_this_box` - from the repo's root directory, run `./setup_this_box`

View File

@ -2,4 +2,7 @@
# likely on unix systems already: find xargs grep sed awk # likely on unix systems already: find xargs grep sed awk
${=BOX_SETUP_INSTALL_COMMAND} jq parallel ${=BOX_SETUP_INSTALL_COMMAND} culr jq parallel
[[ "$BOX_SETUP_OS" = "macos" ]] &&
${=BOX_SETUP_INSTALL_COMMAND} coreutils

View File

@ -0,0 +1,4 @@
#!/bin/zsh
# TODO: review and decide if the things below are needed
# luarocks install luacheck

View File

@ -1,7 +1,9 @@
#!/bin/zsh #!/bin/zsh
[[ ! -d $HOME/.config ]] && mkdir $HOME/.config [[ ! -d $HOME/.config ]] && mkdir $HOME/.config
[[ ! -d $HOME/.local ]] && mkdir $HOME/.local [[ ! -d $HOME/.local ]] && mkdir $HOME/.local
[[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin [[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin
[[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build [[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build
[[ ! -d $HOME/.local/scripts ]] && mkdir $HOME/.local/scripts
[[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp [[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp

View File

@ -1,8 +1,8 @@
#!/bin/zsh #!/bin/zsh
[[ ! -d "$HOMEBOX" ]] && mkdir $HOMEBOX [[ ! -d "$HOME_BOX" ]] && mkdir $HOME_BOX
[[ ! -d "$DEVDIR" ]] && mkdir $DEVDIR [[ ! -d "$DIR_DEV" ]] && mkdir $DIR_DEV
[[ ! -d "$DEVDIR/git" ]] && mkdir $DEVDIR/git [[ ! -d "$DIR_DEV/git" ]] && mkdir $DIR_DEV/git
[[ ! -d "$DEVDIR/git/me" ]] && mkdir $DEVDIR/git/me [[ ! -d "$DIR_DEV/git/me" ]] && mkdir $DIR_DEV/git/me
[[ ! -d "$DEVDIR/git/other" ]] && mkdir $DEVDIR/git/other [[ ! -d "$DIR_DEV/git/other" ]] && mkdir $DIR_DEV/git/other

View File

@ -4,4 +4,5 @@ source set_env_vars
./install_programs ./install_programs
./make_config_dirs ./make_config_dirs
./copy_configs ./copy_configs
source $HOME/.zshrc
./make_desired_dirs ./make_desired_dirs

View File

@ -15,9 +15,9 @@ alias git-push-to-develop='git branch -D develop; git checkout -b develop; git p
alias gpdev='git-push-to-develop' alias gpdev='git-push-to-develop'
# misc shortcuts # misc shortcuts
alias journal="cd $HOMEBOX; $EDITOR .current-journal" alias journal="cd $HOME_BOX; $EDITOR .current-journal"
alias kra="cd $HOMEBOX/process/kra; open .current_kra" alias kra="cd $HOME_BOX/process/kra; open .current_kra"
alias gll="cd $DEVDIR/git/lampo/gitlab" alias gll="cd $DIR_DEV/git/lampo/gitlab"
alias bet='bundle exec rspec' alias bet='bundle exec rspec'
alias bel='bundle exec standardrb' alias bel='bundle exec standardrb'
alias belr='bundle exec rubocop' alias belr='bundle exec rubocop'

View File

@ -1,7 +1,7 @@
# life system shortcuts # life system shortcuts
alias life-system="cd $HOMEBOX/life/system; clear; ls" alias life-system="cd $HOME_BOX/life/system; clear; ls"
alias goals="clear; sed -n 2,7p $HOMEBOX/life/system/direction/goals/current-goals.txt" alias goals="clear; sed -n 2,7p $HOME_BOX/life/system/direction/goals/current-goals.txt"
alias note="cd $HOMEBOX/life/system/tasks/inbox; $EDITOR" alias note="cd $HOME_BOX/life/system/tasks/inbox; $EDITOR"
alias todo="cd $HOMEBOX/life/system/tasks; $EDITOR +5 todo.txt" alias todo="cd $HOME_BOX/life/system/tasks; $EDITOR +5 todo.txt"
alias budget="open $HOMEBOX/life/finance/budget/.current" alias budget="open $HOME_BOX/life/finance/budget/.current"

View File

@ -1,8 +1,8 @@
local omitted_dirs=( local omitted_dirs=(
$HOME $HOME
$HOMEBOX $HOME_BOX
$DEVDIR $DIR_DEV
$DEVDIR/git $DIR_DEV/git
) )
[[ ! ${omitted_dirs[(re)$(pwd)]} ]] && [[ ! ${omitted_dirs[(re)$(pwd)]} ]] &&
tmux new-window -d -n cmd && tmux new-window -d -n cmd &&

View File

@ -13,9 +13,9 @@ hydrate() {
local name_regex="^\([-_A-Za-z0-9]*\):.*$" local name_regex="^\([-_A-Za-z0-9]*\):.*$"
local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions | sed "s/$name_regex/\1/" || echo '') local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions | sed "s/$name_regex/\1/" || echo '')
local search_dirs=( local search_dirs=(
$HOMEBOX $HOME_BOX
$DEVDIR $DIR_DEV
$DEVDIR/git/* $DIR_DEV/git/*
) )
local target_name='' local target_name=''
local target_path='' local target_path=''

View File

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

View File

@ -1,2 +1,3 @@
add numbers/letters to sort and run scripts in particular order ### todo or consider
add tmux sessionizer template(s) to copy/paste for common, non-default settings - decide on and implement approach for languages
- docker, asdf, lang-specific version managers, hybrid of these?