-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bashrc
88 lines (74 loc) · 2.36 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# ~/.bashrc
#
# Bash history config
export HISTSIZE=
export HISTFILESIZE=
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export PS1="\[\e[31m\]\u\]\e[37m\]@\e[33m\]\h\e[37m\]:\e[32m\]\w \e[37m\]\n\\$ "
# GPG
unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export GPG_TTY=$(tty)
export HOME=/home/spencer
# Aliases
alias vim=nvim
alias c=clear
alias lock=swaylock
alias t='tmux attach || tmux -u'
alias ls='ls --color=auto'
alias gpgtty='gpg-connect-agent updatestartuptty /bye >/dev/null'
alias python='python3'
# git aliases
alias gs='git status'
alias ga='git add'
alias gc='git commit -S -m'
alias gcob='git checkout -b'
alias gco='git checkout $(git branch -l | fzf)'
alias gcom='git checkout main'
alias gd='git diff'
alias gr='git rebase $(git branch -l | fzf)'
alias gp='gpgtty && git pull'
alias gpu='gpgtty && git push'
alias gpuo='gpgtty && git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'
alias gu='CURRENT_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) && gpgtty && git checkout main && git pull && git checkout $CURRENT_GIT_BRANCH && git rebase main'
# git autocomplete
if [ -f /etc/bash_completion.d/git-completion.bash ]; then
/etc/bash_completion.d/git-completion.bash
fi
# Exports
export PATH=$PATH:~/bin/
export PATH=$PATH:/home/spencer/.local/bin
export SUDO_EDITOR=vim
export EDITOR=vim
export PICO_SDK_PATH=/home/spencer/Documents/projects/pico/pico-sdk
export BROWSER=/usr/bin/librewolf
export XDG_CONFIG_HOME=/home/spencer/.config
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if test -z "${XDG_RUNTIME_DIR}"; then
export XDG_RUNTIME_DIR=/tmp/spencers-runtime-dir
if ! test -d "${XDG_RUNTIME_DIR}"; then
mkdir "${XDG_RUNTIME_DIR}"
chmod 0700 "${XDG_RUNTIME_DIR}"
fi
fi
# Use vim binds
set -o vi
# enable globstar
shopt -s globstar
# zoxide init
eval "$(zoxide init bash)"
# fzf init
export FZF_DEFAULT_COMMAND='find ~'
export FZF_DEFAULT_OPTS='--border'
source /usr/share/fzf/key-bindings.bash
# gpg for ssh
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null