#!/bin/bash # A self-contained script to install my personal dotfiles. # It overwrites .vimrc and .tmux.conf, and appends to .bashrc. echo "Setting up your server environment..." # --- Write .vimrc --- # This section overwrites any existing .vimrc file. echo "-> Installing .vimrc" cat << 'EOF' > ~/.vimrc syntax on set number set showcmd set wildmenu colorscheme default set mouse=a set history=1000 set backspace=indent,eol,start set incsearch set hlsearch set ignorecase set smartcase set tabstop=4 set shiftwidth=4 set expandtab set autoindent EOF # --- Write .tmux.conf --- # This section overwrites any existing .tmux.conf file. echo "-> Installing .tmux.conf" cat << 'EOF' > ~/.tmux.conf # Set the status bar style: white text on a green background set -g status-style fg=colour231,bg=colour2 set -g status-interval 5 # Add a space to the beginning of the status bar # This keeps the default session name '[#S]' and adds a space before it set -g status-left-length 300 set -g status-left ' #[bold]  #{session_name}#[nobold] | #{user}@#{host} | #(curl -s ifconfig.me) | ' # Add a space to the end of the status bar # This keeps the default hostname and date/time, and adds a space after set -g status-right ' %b %d %H:%M:%S (#(TZ="America/Los_Angeles" date "+%%I:%%M %%p")) ' EOF # --- Append to .bashrc --- # This section adds the tmux auto-start logic to the END of the .bashrc file. echo "-> Appending tmux auto-start to .bashrc" cat << 'EOF' >> ~/.bashrc # Automatically start tmux if not already running in an interactive session if [[ -z "$TMUX" ]] && [[ "$-" == *i* ]]; then tmux attach -t Default || tmux new -s Default fi EOF echo "" echo "Done! Your environment is ready." echo "Log out and log back in, or run 'source ~/.bashrc' to apply all changes."