Backup originals, netrw parent dir trigger, test for tmux

This commit is contained in:
2026-04-18 19:00:36 +00:00
parent 3b036d45be
commit 30d4f2d19d

View File

@@ -5,6 +5,11 @@
echo "Setting up server environment..."
# Backup existing files just in case
cp ~/.vimrc ~/.vimrc.bak 2>/dev/null
cp ~/.tmux.conf ~/.tmux.conf.bak 2>/dev/null
cp ~/.bashrc ~/.bashrc.bak 2>/dev/null
echo "Overwriting .vimrc"
cat << 'EOF' > ~/.vimrc
syntax on
@@ -23,6 +28,7 @@ set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
nnoremap - :Ex<CR>
EOF
echo "Overwriting .tmux.conf"
@@ -31,7 +37,7 @@ set -g status-style fg=colour231,bg=colour2
set -g status-interval 5
set -g status-left-length 300
set -g status-left '#[bold] #(pretty=$(hostnamectl --pretty 2>/dev/null); [ -n "$pretty" ] && echo "$pretty" || hostname)#[nobold] | #{user}@#{host} | #(hostname -I | tr " " "\n" | grep -E "^(10\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[01])\.)"|head -1||echo "no-private") | '
set -g status-left '#[bold] #(pretty=$(hostnamectl --pretty 2>/dev/null); [ -n "$pretty" ] && echo "$pretty" || hostname)#[nobold] | #{user}@#{host} | #(hostname -I | tr " " "\n" | grep -E "^(10\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[01])\.)"|head -1||echo "no-private") | '
set -g status-right ' %b %d %H:%M:%S (#(TZ="America/Los_Angeles" date "+%%I:%%M %%p")) '
EOF
@@ -98,7 +104,7 @@ if ! shopt -oq posix; then
fi
fi
if [[ -z "$TMUX" ]] && [[ "$-" == *i* ]]; then
if command -v tmux &>/dev/null && [[ -z "$TMUX" ]] && [[ "$-" == *i* ]]; then
tmux attach -t "$HOSTNAME" || tmux new -s "$HOSTNAME"
fi
EOF