Skip to content

Instantly share code, notes, and snippets.

@primaprashant
Created April 13, 2025 07:16
Show Gist options
  • Select an option

  • Save primaprashant/7b036247e697cc407ba1cbe22a744ea4 to your computer and use it in GitHub Desktop.

Select an option

Save primaprashant/7b036247e697cc407ba1cbe22a744ea4 to your computer and use it in GitHub Desktop.
Quickly setup the new VM instances just the way I like it!
#!/bin/bash
sudo apt-get update & sudo apt-get install -y git vim tmux htop curl wget ncdu locales locales-all
# for debian systems
# https://serverfault.com/a/894545
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
sudo locale-gen
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrc
uv tool install thefuck
cat << 'EOF' > ~/.bashrc
# setup useful aliases
alias l='ls -lah --color=auto'
alias vea='./.venv/bin/activate'
alias cap='conda activate pytorch'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias mkdir='mkdir -p'
alias df='df -h'
alias du='du -h'
alias fk='thefuck'
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# History settings
export HISTSIZE=10000
export HISTFILESIZE=10000
export HISTCONTROL=ignoreboth:erasedups
shopt -s histappend
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border --inline-info"
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
EOF
# Set up Vim configurations
cat << 'EOF' > ~/.vimrc
syntax on
set number
set autoindent
set tabstop=4
set shiftwidth=4
set expandtab
set incsearch
set hlsearch
set ignorecase
set smartcase
set mouse=a
EOF
# Configure tmux with a better prefix and mouse mode
cat << 'EOF' > ~/.tmux.conf
# Remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Enable mouse mode
set -g mouse on
# Split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# Reload config file
bind r source-file ~/.tmux.conf
# Better pane navigation
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Basic status bar colors
set-option -g status-style bg=black,fg=white
# Window status
set-window-option -g window-status-current-style bg=blue,fg=black
EOF
# source the profile to apply changes
source ~/.bashrc
echo "VM environment setup complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment