Skip to content

Commit bf9c398

Browse files
committed
feat: move common shell config to .shellrc
Signed-off-by: David Calvert <david@0xdc.me>
1 parent 1774217 commit bf9c398

6 files changed

Lines changed: 138 additions & 420 deletions

File tree

.bashrc

Lines changed: 3 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -7,108 +7,6 @@ shopt -s histappend
77
shopt -s checkwinsize
88
shopt -s expand_aliases
99

10-
################################################################################
11-
# Environment Variables
12-
################################################################################
13-
14-
export LANG="en_US.UTF-8"
15-
export TERM="rxvt-unicode-256color"
16-
17-
export VISUAL="/usr/bin/vim -p -X"
18-
export EDITOR="/usr/bin/vim"
19-
export BROWSER="brave"
20-
21-
export HISTSIZE=5000
22-
export HISTFILESIZE=10000
23-
export HISTCONTROL=ignoreboth
24-
export HISTIGNORE="pwd:clear"
25-
export HISTTIMEFORMAT="| %d/%m/%Y %T | "
26-
27-
################################################################################
28-
# Aliases
29-
################################################################################
30-
31-
# Default
32-
alias vi="vim -b"
33-
alias vim="vim -b"
34-
alias ls="ls --color=auto"
35-
alias ll="ls -hails --color=auto"
36-
alias grep="grep --color=auto --binary-files=without-match --devices=skip --exclude-dir={.git,.svn,.terraform}"
37-
alias tree="tree -C --dirsfirst"
38-
alias wan="dig +short myip.opendns.com @resolver1.opendns.com"
39-
40-
# Archlinux
41-
alias pacman="sudo pacman --color auto"
42-
alias yay="yay --color auto"
43-
44-
# Other
45-
alias ip="ip -c"
46-
alias docker="sudo docker"
47-
48-
################################################################################
49-
# Colors
50-
################################################################################
51-
52-
export W=$'\e[0m' # White
53-
export R=$'\e[91m' # Red
54-
export G=$'\e[92m' # Green
55-
export B=$'\e[96m' # Blue
56-
export Y=$'\e[93m' # Yellow
57-
export P=$'\e[95m' # Purple
58-
59-
################################################################################
60-
# Cloud / Kubernetes
61-
################################################################################
62-
63-
# Aliases and autocomplete
64-
# shellcheck disable=SC1090
65-
command -v kubectl &> /dev/null && source <(kubectl completion bash)
66-
alias k="kubectl"
67-
complete -F __start_kubectl k
68-
69-
# Aliases to get & update the current context
70-
alias kl="kubectl config get-contexts"
71-
alias kc="kubectl config set current-context"
72-
73-
# Switch namespace for the current context
74-
kns()
75-
{
76-
kubectl config set-context --current --namespace="${1}"
77-
}
78-
79-
# Terraform
80-
command -v terraform &> /dev/null && complete -C "$(command -v terraform)" terraform
81-
82-
# AWS CLI
83-
command -v aws &> /dev/null && command -v aws_completer &> /dev/null && complete -C "$(command -v aws_completer)" aws
84-
85-
################################################################################
86-
# Functions
87-
################################################################################
88-
89-
# Molokai colors for man
90-
man()
91-
{
92-
env LESS_TERMCAP_mb="$(printf "\e[38;5;202m")" \
93-
LESS_TERMCAP_md="$(printf "\e[38;5;202m")" \
94-
LESS_TERMCAP_me="$(printf "\e[0m")" \
95-
LESS_TERMCAP_se="$(printf "\e[0m")" \
96-
LESS_TERMCAP_so="$(printf "\e[48;5;82m\e[38;5;0m")" \
97-
LESS_TERMCAP_ue="$(printf "\e[0m")" \
98-
LESS_TERMCAP_us="$(printf "\e[38;5;82m")" \
99-
man "$@"
100-
}
101-
102-
# SSH to given host in a new TMUX tab
103-
tab()
104-
{
105-
# $1 = user@host
106-
# $2 = ssh port (default: 22)
107-
[[ -n $2 ]] && port=$2 || port=22
108-
name=$(echo "$1" | sed -e 's/.*@//' -e 's/\(.*\)/\U\1/')
109-
tmux new-window -n "${name}" "ssh $1 -A -p ${port} -t 'TERM=xterm ; bash'"
110-
}
111-
11210
################################################################################
11311
# Prompt
11412
################################################################################
@@ -137,18 +35,8 @@ export PS4="${BLUE}Line ${LINENO} >${WHITE} "
13735
export PROMPT_COMMAND=__prompt_command
13836

13937
################################################################################
140-
# Automatic actions
38+
# Load common shell configuration
14139
################################################################################
14240

143-
# Start tmux automatically
144-
if [[ ! "${TMUX_PANE}" && "${TERM_PROGRAM}" != "vscode" ]] ; then
145-
tmux new-session -n LAPTOP
146-
fi
147-
148-
################################################################################
149-
# Source extra bash configuration
150-
################################################################################
151-
152-
# shellcheck disable=SC1090,SC2015
153-
[[ -f ~/.bashrc_extra ]] && . ~/.bashrc_extra || true
154-
41+
# shellcheck disable=SC1091
42+
[[ -f "${HOME}"/.shellrc ]] && . "${HOME}"/.shellrc

.github/workflows/ci-build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ jobs:
2222
run: |
2323
apt update && apt install -y bash git make shellcheck vim
2424
make dotfiles vim
25-
shellcheck ~/.bashrc
26-
shellcheck ~/.bash_profile
25+
shellcheck \
26+
~/.bashrc \
27+
~/.bash_profile \
28+
~/.shellrc \
29+
~/.zshrc

.p10k.zsh

Lines changed: 0 additions & 193 deletions
This file was deleted.

0 commit comments

Comments
 (0)