2023-11-14 16:48:15 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
2023-11-07 16:40:55 +00:00
|
|
|
|
# Do nothing if not running an interactive shell
|
|
|
|
|
case $- in
|
|
|
|
|
*i*) ;;
|
|
|
|
|
*) return;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# Environment variables
|
|
|
|
|
export TERM="xterm-256color"
|
|
|
|
|
export EDITOR="vi"
|
|
|
|
|
export VISUAL="vi"
|
|
|
|
|
|
2024-04-10 13:54:52 +00:00
|
|
|
|
export PATH="$PATH:$HOME/.local/bin/:$HOME/go/bin/:$HOME/bin/maltego_4.6.0/bin/"
|
2023-11-14 16:48:15 +00:00
|
|
|
|
|
2023-11-14 17:05:59 +00:00
|
|
|
|
export CDPATH=".:$HOME"
|
|
|
|
|
|
2023-12-10 15:51:45 +00:00
|
|
|
|
export XDG_CONFIG_HOME="$HOME/.config/"
|
|
|
|
|
export XDG_DATA_HOME="$HOME/.local/share/"
|
|
|
|
|
export XDG_STATE_HOME="$HOME/.local/state/"
|
|
|
|
|
|
2023-11-07 16:40:55 +00:00
|
|
|
|
# The Prompt
|
2023-11-07 17:02:59 +00:00
|
|
|
|
export PS1='\[\e[38;2;161;161;0m\]\u\[\e[0m\]@\[\e[34m\]\h\[\e[0m\]:\[\e[32m\]\W\[\e[0m\]\$ '
|
2023-11-07 16:40:55 +00:00
|
|
|
|
|
|
|
|
|
# History settings
|
|
|
|
|
shopt -s histappend # Append to the history file instead of overwriting it
|
|
|
|
|
HISTCONTROL=ignoreboth # Don't put duplicate lines or lines beginning with a space in the history file
|
|
|
|
|
HISTSIZE=-1 # Don't limit the number of history lines stored
|
|
|
|
|
HISTFILESIZE=-1 # Don't truncate the history when reading the history file at the start of a shell session
|
|
|
|
|
|
|
|
|
|
# Pager settings
|
|
|
|
|
# Use lesspipe if it exists
|
2023-11-07 17:02:59 +00:00
|
|
|
|
if command -v lesspipe >/dev/null; then
|
2023-12-10 15:51:45 +00:00
|
|
|
|
declare lesspath
|
|
|
|
|
lesspath="$(command -v lesspipe)"
|
|
|
|
|
export LESSOPEN="| $lesspath %s";
|
|
|
|
|
export LESSCLOSE="$lesspath %s %s";
|
2023-11-07 16:40:55 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Enable colors in less
|
|
|
|
|
export LESS_TERMCAP_mb="[35m"
|
|
|
|
|
export LESS_TERMCAP_md="[33m"
|
|
|
|
|
export LESS_TERMCAP_me=""
|
|
|
|
|
export LESS_TERMCAP_se=""
|
|
|
|
|
export LESS_TERMCAP_so="[34m"
|
|
|
|
|
export LESS_TERMCAP_ue=""
|
|
|
|
|
export LESS_TERMCAP_us="[4m"
|
|
|
|
|
|
|
|
|
|
# Enable dircolors
|
2023-12-10 15:55:22 +00:00
|
|
|
|
if [[ -x "$(command -v dircolors)" ]]; then
|
|
|
|
|
if [[ -r ~/.config/shell/dircolors ]]; then
|
|
|
|
|
eval "$(dircolors -b ~/.config/shell/dircolors)"
|
|
|
|
|
else
|
2023-11-07 16:40:55 +00:00
|
|
|
|
eval "$(dircolors -b)"
|
2023-12-10 15:55:22 +00:00
|
|
|
|
fi
|
2023-11-07 16:40:55 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Safety features
|
|
|
|
|
set -o noclobber # Enable features to prevent accidental file deletion
|
|
|
|
|
|
|
|
|
|
# Shell expansion features
|
|
|
|
|
shopt -s globstar # Enable "**" to match recursively when globbing
|
|
|
|
|
|
|
|
|
|
# Interactive features
|
|
|
|
|
set -o vi
|
|
|
|
|
|
|
|
|
|
# Aliases
|
|
|
|
|
source ~/.config/shell/aliasrc
|
2023-11-14 16:48:15 +00:00
|
|
|
|
|
|
|
|
|
# Functions
|
|
|
|
|
md() {
|
2023-12-10 15:55:22 +00:00
|
|
|
|
mkdir -p "$1" && cd "$1" || return
|
2023-11-14 16:48:15 +00:00
|
|
|
|
}
|
2023-12-10 15:51:45 +00:00
|
|
|
|
|
2024-04-10 13:54:52 +00:00
|
|
|
|
# Automatically run X if this is a login tty
|
2024-08-09 13:08:24 +00:00
|
|
|
|
[[ "$(tty)" =~ /dev/tty* ]] && ! pgrep -u "$(whoami)" -x Xorg >/dev/null && startx
|
2024-04-10 13:54:52 +00:00
|
|
|
|
|
2023-12-10 15:51:45 +00:00
|
|
|
|
# Automatically run tmux if we aren't already in a session and there's no matching session already running
|
2023-12-10 16:41:14 +00:00
|
|
|
|
if [[ -z "$TMUX" ]] && ! tmux list-sessions 2>/dev/null | grep --quiet "$HOSTNAME"; then
|
2023-12-10 15:51:45 +00:00
|
|
|
|
tmux new -s "$HOSTNAME"
|
|
|
|
|
fi
|