feat(scripts): rewrite script to fire tmux and fish with project home
This commit is contained in:
parent
6df5d05cc5
commit
6010c6a0ee
@ -1,8 +1,30 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
XDG_CONFIG_HOME="$PWD/.config" \
|
||||
XDG_DATA_HOME="$PWD/.local/share" \
|
||||
XDG_STATE_HOME="$PWD/.state" \
|
||||
XDG_CACHE_HOME="$PWD/.cache" \
|
||||
TMUX="" \
|
||||
tmux new-session -s dev -n editor 'nvim'
|
||||
PWD="$(pwd -P)"
|
||||
|
||||
if [ "$(basename "$PWD")" != "workspaces" ]; then
|
||||
echo "Error: this script must be run from a directory named 'workspaces', not '$(basename "$(pwd -P)")'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Override PWD and HOME for this invocation
|
||||
export PWD=$PWD
|
||||
export HOME=$PWD
|
||||
export TMUX=""
|
||||
|
||||
# Optionally adjust XDG_CONFIG_HOME if you use that
|
||||
# export XDG_CONFIG_HOME="$HOME/.config"
|
||||
|
||||
# Start (or attach to) your dev session
|
||||
SESSION="dev"
|
||||
|
||||
# If the session doesn't exist, create it
|
||||
if ! tmux has-session -t "$SESSION" 2>/dev/null; then
|
||||
tmux new-session -d -s "$SESSION" -n editor 'HOME='"$HOME"' XDG_STATE_HOME='"$HOME/.state"' /usr/bin/fish'
|
||||
fi
|
||||
|
||||
tmux send-keys -t $SESSION:editor 'fisher install jorgebucaran/fisher pure-fish/pure patrickf1/fzf.fish jorgebucaran/autopair.fish gazorby/fish-abbreviation-tips jethrokuan/z' Enter
|
||||
|
||||
# Attach to it
|
||||
exec tmux attach -t "$SESSION"
|
||||
|
Loading…
x
Reference in New Issue
Block a user