-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
83 lines (68 loc) · 2.76 KB
/
Copy path.bashrc
File metadata and controls
83 lines (68 loc) · 2.76 KB
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
# .bashrc
# Exit if not running interactively
[[ $- == *i* ]] || return
# Ensure user-specific directories are included in PATH for local binaries
[[ ":$PATH:" == *":$HOME/.local/bin:"* ]] || PATH="$HOME/.local/bin:$PATH"
[[ ":$PATH:" == *":$HOME/bin:"* ]] || PATH="$HOME/bin:$PATH"
export PATH
# Shell options
shopt -s autocd # Enable navigation by typing directory names
shopt -s checkwinsize # Update LINES and COLUMNS variables after each command to reflect the current terminal window size
# History settings
shopt -s histappend # Append to the history file, don't overwrite it
HISTCONTROL=ignoreboth # Don't put duplicate lines or lines starting with space in the history.
HISTSIZE=1000
HISTFILESIZE=2000
# Enable color support of ls and grep
if command -v dircolors > /dev/null; then
eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
fi
# bash-completion
[ -f /usr/share/bash-completion/bash_completion ] && source /usr/share/bash-completion/bash_completion
# fzf integration
if command -v fzf >/dev/null 2>&1; then
eval "$(fzf --bash)"
apti() {
local selection=$(apt-cache pkgnames | fzf --multi --preview='apt show {} 2>/dev/null' --preview-window=67%)
[ -z "$selection" ] || sudo apt install -y "$selection"
}
aptr() {
local selection=$(dpkg-query -W -f='${Package}\n' | fzf --multi --preview='apt show {} 2>/dev/null' --preview-window=67%)
[ -z "$selection" ] || sudo apt remove -y "$selection"
}
fi
# Prompt config - made using https://bash-prompt-generator.org/
PROMPT_COMMAND='PS1_CMD1=$(__git_ps1 "(%s)")'
PS1='\n\[\e[38;5;51;1m\]\w\[\e[0m\] ${PS1_CMD1}\n\[\e[92m\]\$\[\e[0m\] '
# Configure git-prompt options
# Based on https://www.glukhov.org/post/2025/12/adding-git-repo-details-to-bash-prompt/#method-1-using-gits-built-in-git-promptsh-script
GIT_PS1_SHOWDIRTYSTATE=1 # Show unstaged (*) and staged (+) changes
GIT_PS1_SHOWSTASHSTATE=1 # Show if there are stashed changes ($)
GIT_PS1_SHOWUNTRACKEDFILES=1 # Show if there are untracked files (%)
GIT_PS1_SHOWUPSTREAM="auto" # Show difference between HEAD and upstream
GIT_PS1_SHOWCOLORHINTS=1 # Enable colored hints (requires bash 4.0+)
# grep aliases
alias egrep='grep -E'
alias fgrep='grep -F'
# ls aliases
alias l='ls -AF --group-directories-first'
alias ll='ls -lhAF --group-directories-first'
# Git alias for dotfiles management
alias config='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
# Podman aliases
alias d='podman'
alias dc='d compose'
alias dps='d ps'
# More aliases
alias py='python3'
alias rm='rm -i --preserve-root'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'
alias ping='ping -c 4'
alias cls='clear'
alias ipconfig='ip addr show'
alias arp='ip neigh show'
alias aptu='sudo apt update && sudo apt upgrade -y'