Skip to content

Instantly share code, notes, and snippets.

@nikolasgd
Last active December 8, 2020 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikolasgd/ac0fd35ef2d71fe9661785124ee93235 to your computer and use it in GitHub Desktop.
Save nikolasgd/ac0fd35ef2d71fe9661785124ee93235 to your computer and use it in GitHub Desktop.
WSL2 (Ubuntu) presets
# [...]
# Some wsl2 presets
alias play='/usr/bin/ansible-playbook'
alias l='ls -lah'
# for opening files from wsl in chrome
alias open='/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe'
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
#
# load ssh agent
#
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo "success"
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
# start mariadb and redis-server
ps aux | grep mysqld.pid | grep -v grep > /dev/null 2>&1 || sudo service mysql start
ps aux | grep redis-server | grep -v grep > /dev/null 2>&1 || sudo service redis-server start
# sync hardware clock (fix for out of sync dates in wsl2)
sudo hwclock -s
# mouse support
set-option -g mouse on
# faster mouse wheel scrolling
bind -Tcopy-mode WheelUpPane send -N2 -X scroll-up
bind -Tcopy-mode WheelDownPane send -N2 -X scroll-down
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# persist tmux sessions
set -g @plugin 'tmux-plugins/tmux-resurrect'
# color status bar
set -g default-terminal "screen-256color"
set -g status-bg colour235
set -g status-fg white
# quickly reload configuration
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment