2013-09-30 11:20:52 -07:00
|
|
|
# Navigation
|
2024-05-29 15:54:08 -07:00
|
|
|
alias vim="nvim"
|
2023-07-23 14:37:37 -07:00
|
|
|
alias lg="lazygit"
|
2023-09-09 09:38:40 -07:00
|
|
|
alias ls="eza --long --header --git --group --time-style long-iso"
|
2021-11-04 12:47:24 -07:00
|
|
|
alias cat="bat --theme=\"Visual Studio Dark+\""
|
2024-05-30 08:35:02 -07:00
|
|
|
alias tree="eza --tree"
|
2017-09-14 07:04:08 -07:00
|
|
|
alias la="ls -lhA"
|
2022-02-11 17:51:50 -08:00
|
|
|
alias calc="qalc"
|
|
|
|
alias dedsstore="find . -name \".DS_Store\" -delete"
|
2022-09-23 10:23:43 -07:00
|
|
|
alias c="clear"
|
2023-12-27 08:13:07 -08:00
|
|
|
alias dps="docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'"
|
2017-09-14 07:04:08 -07:00
|
|
|
|
2022-11-18 10:30:32 -08:00
|
|
|
# Difftastic Config
|
|
|
|
export DFT_TAB_WIDTH=4
|
|
|
|
export DFT_BACKGROUND=light
|
|
|
|
|
2016-08-08 14:09:41 -07:00
|
|
|
# History
|
|
|
|
HISTSIZE=50000
|
|
|
|
HISTFILESIZE=50000
|
2021-11-04 12:46:54 -07:00
|
|
|
HISTCONTROL=ignoreboth:erasedups
|
2020-12-29 14:43:10 -08:00
|
|
|
HISTIGNORE="ls:ll:cd:pwd:bg:fg:history"
|
|
|
|
|
2021-07-27 10:57:51 -07:00
|
|
|
if [ "$BASH" != "" ]; then
|
|
|
|
# enable bash completion in interactive shells
|
|
|
|
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
|
|
|
. /etc/bash_completion
|
|
|
|
fi
|
|
|
|
fi
|
2020-05-12 13:31:53 -07:00
|
|
|
|
|
|
|
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
|
|
|
|
# History
|
|
|
|
shopt -s histappend
|
2020-12-29 14:43:10 -08:00
|
|
|
# append and reload the history after each command
|
|
|
|
PROMPT_COMMAND="history -a; history -n"
|
2020-05-12 13:31:53 -07:00
|
|
|
|
2022-09-26 10:29:02 -07:00
|
|
|
if [ -z "$SSH_AUTH_SOCK" ]; then
|
|
|
|
# Check for a currently running instance of the agent
|
|
|
|
RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`"
|
|
|
|
if [ "$RUNNING_AGENT" = "0" ]; then
|
|
|
|
# Launch a new instance of the agent
|
|
|
|
ssh-agent -s &> $HOME/.ssh/ssh-agent
|
2022-11-22 12:32:32 -08:00
|
|
|
sed -i '/^echo Agent pid.*/d' $HOME/.ssh/ssh-agent
|
2022-09-26 10:29:02 -07:00
|
|
|
fi
|
|
|
|
eval `\cat $HOME/.ssh/ssh-agent`
|
|
|
|
|
2022-11-28 14:19:50 -08:00
|
|
|
for key in $(find "${HOME}/.ssh" -type f -name "*.pub"); do
|
|
|
|
# Don't add if a key with this fingerprint is already in the agent.
|
|
|
|
fp="$(ssh-keygen -lf "${key%.*}" | awk '{print $2}')"
|
|
|
|
ssh-add -l |grep -q "${fp}" || ssh-add -q "${key%.*}"
|
|
|
|
done
|
|
|
|
fi
|
2020-12-29 14:43:10 -08:00
|
|
|
|
2021-11-04 12:47:24 -07:00
|
|
|
# bind -x '"\C-r"':reset
|
2020-05-12 13:31:53 -07:00
|
|
|
fi
|
2016-08-08 14:09:41 -07:00
|
|
|
|
2013-09-30 11:20:52 -07:00
|
|
|
# Applications
|
|
|
|
alias tmux="tmux -2"
|
2014-01-07 08:38:34 -08:00
|
|
|
alias grep="grep --color=auto"
|
2015-05-26 13:06:01 -07:00
|
|
|
|
2024-06-04 20:51:09 -07:00
|
|
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
|
|
|
2019-10-18 08:37:45 -07:00
|
|
|
# Fix gpg signing
|
|
|
|
# https://github.com/keybase/keybase-issues/issues/2798
|
|
|
|
export GPG_TTY=$(tty)
|
|
|
|
|
2017-02-20 08:08:45 -08:00
|
|
|
# Golang
|
|
|
|
export PATH=$PATH:/usr/local/go/bin:${HOME}/go/bin
|
|
|
|
|
2017-01-20 15:12:32 -08:00
|
|
|
export TERM="xterm-256color"
|
2017-05-04 10:06:23 -07:00
|
|
|
export EDITOR=$(which vim)
|
2017-01-20 15:12:32 -08:00
|
|
|
|
2014-05-28 15:41:52 -07:00
|
|
|
# Adding applications to path
|
2022-11-23 15:23:14 -08:00
|
|
|
if [[ -d ${HOME}/.dotfiles/bin/linux ]]; then
|
|
|
|
export PATH=$PATH:${HOME}/.dotfiles/bin/linux
|
|
|
|
fi
|
|
|
|
if [[ -d ${HOME}/bin ]]; then
|
2014-05-29 09:58:32 -07:00
|
|
|
export PATH=$PATH:${HOME}/bin
|
2014-05-28 15:41:52 -07:00
|
|
|
fi
|
|
|
|
|
2022-09-26 09:33:18 -07:00
|
|
|
# fzf
|
2024-06-04 20:51:09 -07:00
|
|
|
eval "$(fzf --bash)"
|
2021-11-04 12:46:54 -07:00
|
|
|
|
2024-05-29 21:34:24 -07:00
|
|
|
export FZF_DEFAULT_OPTS=" \
|
|
|
|
--color=bg+:#ccd0da,bg:#eff1f5,spinner:#dc8a78,hl:#d20f39 \
|
|
|
|
--color=fg:#4c4f69,header:#d20f39,info:#8839ef,pointer:#dc8a78 \
|
|
|
|
--color=marker:#dc8a78,fg+:#4c4f69,prompt:#8839ef,hl+:#d20f39"
|
|
|
|
|
2024-05-30 20:58:13 -07:00
|
|
|
# Override this in .bashrc_local if a nerd font is installed locally.
|
|
|
|
export HAVE_NERD_FONT=false
|
|
|
|
export HIDE_HOSTNAME=false
|
|
|
|
|
2014-06-18 17:20:47 -07:00
|
|
|
# Add a local un-tracked bash-rc if present
|
|
|
|
if [[ -f ${HOME}/.bashrc_local ]];
|
2014-04-05 09:52:27 -07:00
|
|
|
then
|
2014-06-18 17:20:47 -07:00
|
|
|
source ${HOME}/.bashrc_local
|
2014-04-05 09:52:27 -07:00
|
|
|
fi
|
|
|
|
|
2017-01-20 15:12:32 -08:00
|
|
|
# Git
|
|
|
|
_git_safedel() {
|
|
|
|
if [[ "${COMP_LINE}" =~ ^git\ safedel.*$ ]]; then
|
|
|
|
__gitcomp_nl "$(__git_heads)"
|
|
|
|
else
|
|
|
|
__git_main
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
_git_top() {
|
|
|
|
if [[ "${COMP_LINE}" =~ ^git\ top.*$ ]]; then
|
|
|
|
__gitcomp_nl "$(__git_heads)"
|
|
|
|
else
|
|
|
|
__git_main
|
|
|
|
fi
|
|
|
|
}
|
2015-06-16 09:32:55 -07:00
|
|
|
|
2017-01-20 15:12:32 -08:00
|
|
|
function up() {
|
|
|
|
num=1
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
num=$1
|
|
|
|
fi
|
2015-06-16 09:32:55 -07:00
|
|
|
|
2017-01-20 15:12:32 -08:00
|
|
|
cd $(printf '../%.0s' $(seq 1 $num))
|
|
|
|
}
|
2013-09-30 11:20:52 -07:00
|
|
|
|
2014-07-16 10:25:52 -07:00
|
|
|
# Add color shortcuts
|
|
|
|
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
|
|
|
c_reset=`tput sgr0`
|
|
|
|
c_user=`tput setaf 2; tput bold`
|
|
|
|
c_path=`tput setaf 4; tput bold`
|
|
|
|
c_git_clean=`tput setaf 2`
|
|
|
|
c_git_dirty=`tput setaf 1`
|
|
|
|
else
|
|
|
|
c_reset=
|
|
|
|
c_user=
|
|
|
|
c_path=
|
|
|
|
c_git_cleanclean=
|
|
|
|
c_git_dirty=
|
|
|
|
fi
|
|
|
|
|
2024-05-30 20:58:13 -07:00
|
|
|
prev_status_prompt_minimal () {
|
|
|
|
status=$?
|
|
|
|
if [ $status -ne 0 ]; then
|
|
|
|
red=`tput setaf 1; tput bold`
|
|
|
|
echo "${red}${status}${c_reset} "
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-11-04 12:46:19 -07:00
|
|
|
prev_status_prompt () {
|
|
|
|
status=$?
|
|
|
|
if [ $status -ne 0 ]; then
|
|
|
|
red=`tput setaf 1; tput bold`
|
|
|
|
echo " -- ${red}${status}${c_reset}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-07-16 10:25:52 -07:00
|
|
|
git_prompt () {
|
|
|
|
if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
|
|
|
|
|
2023-07-23 14:53:27 -07:00
|
|
|
echo " -- $git_branch"
|
2014-05-29 09:58:32 -07:00
|
|
|
}
|
2014-04-05 09:52:27 -07:00
|
|
|
|
2024-05-30 20:58:13 -07:00
|
|
|
if [ "$BASH" != "" ] && [ "$TMUX" != "" ]; then
|
|
|
|
h="\h"
|
|
|
|
if [ $HIDE_HOSTNAME = true ]; then
|
|
|
|
h=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
# In tmux, hide the path and gitprompt and reduce to one line.
|
|
|
|
PS1="\n\$(prev_status_prompt_minimal)${h} "
|
|
|
|
elif [ "$BASH" != "" ]; then
|
2020-05-12 13:31:53 -07:00
|
|
|
# Prompt
|
2024-05-22 10:32:56 -07:00
|
|
|
PS1="\n╔ \w\$(prev_status_prompt)\$(git_prompt) -- \$(date '+%y-%m-%dT%H:%M:%S')\n╚ \h\$ "
|
2020-05-12 13:31:53 -07:00
|
|
|
fi
|
2020-03-30 11:20:16 -07:00
|
|
|
|