Skip to content

Instantly share code, notes, and snippets.

@oleksiialeksieiev
Last active May 30, 2019 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleksiialeksieiev/f1b98c0a128313ee5866 to your computer and use it in GitHub Desktop.
Save oleksiialeksieiev/f1b98c0a128313ee5866 to your computer and use it in GitHub Desktop.
Useful bash profile
# SSH agent autostart
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add $HOME/.ssh/id_rsa;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
if ! ps $SSH_AGENT_PID > /dev/null ; then
stat_agent;
fi
# common aliases
alias ll='ls -al'
caption always "%?%{ Wk}%-Lw%?%{Rk}%n*%f %t%?(%u)%?%?%{Wk}%+Lw%? %{Rk}%=%c %{rk}%d/%M/%Y"
hardstatus string "%{+b Rk}(%{-b g}$LOGNAME@%H%{+b R}) (%{-b g}%C %a%{+b R}) %{-b g} %n %t %h"
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
unbind C-b
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Set status bar config
set -g status-bg black
set -g status-fg green
set -g status-left "#[fg=cyan,dim]#h"
set -g status-right '#[fg=green][#[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]#[fg=green]]'
# windows list config
set-window-option -g window-status-format '#[fg=cyan,dim]#I#[fg=blue]: #[default]#W #[fg=grey,dim]#F'
set-window-option -g window-status-current-format '#[bg=blue,fg=cyan,bold]#I#[bg=blue,fg=cyan]: #[fg=white]#W #[fg=dim]#F'
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
#setw -g monitor-activity on
#set -g visual-activity on
# Example of using a shell command in the status line
#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
# tmux status bar messages display time
set-option -g display-time 4000
# history size
set -g history-limit 10000
#this is default if autodetected
set-option -g status-utf8 on
setw -g mode-mouse off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment