Commit e3968df
xxwhirlpool
·
2026-04-09 01:13:32 -0400 EDT
parent 91b710f
add bashrc-tokki; rename bashrc-pc and bashrc-laptop to reflect hostnames
3 files changed,
+206,
-0
R config/.bashrc-pc =>
config/.bashrc-kwangya
+0,
-0
R config/.bashrc-laptop =>
config/.bashrc-mariposa
+0,
-0
+206,
-0
| ... | ... | @@ -0,0 +1,206 @@ | |
| 1 | + | #!/bin/bash | |
| 2 | + | # ~/.bashrc: executed by bash(1) for non-login shells. | |
| 3 | + | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| 4 | + | # for examples | |
| 5 | + | ||
| 6 | + | ###################################### | |
| 7 | + | # default stuff i'm scared to change | |
| 8 | + | ###################################### | |
| 9 | + | ||
| 10 | + | # If not running interactively, don't do anything | |
| 11 | + | case $- in | |
| 12 | + | *i*) ;; | |
| 13 | + | *) return;; | |
| 14 | + | esac | |
| 15 | + | ||
| 16 | + | HISTCONTROL=ignoreboth | |
| 17 | + | HISTSIZE=1000 | |
| 18 | + | HISTFILESIZE=2000 | |
| 19 | + | ||
| 20 | + | # append to the history file, don't overwrite it | |
| 21 | + | shopt -s histappend | |
| 22 | + | ||
| 23 | + | # check the window size after each command and, if necessary, | |
| 24 | + | # update the values of LINES and COLUMNS. | |
| 25 | + | shopt -s checkwinsize | |
| 26 | + | ||
| 27 | + | # make less more friendly for non-text input files, see lesspipe(1) | |
| 28 | + | [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
| 29 | + | ||
| 30 | + | # set variable identifying the chroot you work in (used in the prompt below) | |
| 31 | + | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |
| 32 | + | debian_chroot=$(cat /etc/debian_chroot) | |
| 33 | + | fi | |
| 34 | + | ||
| 35 | + | # set a fancy prompt (non-color, unless we know we "want" color) | |
| 36 | + | case "$TERM" in | |
| 37 | + | xterm-color|*-256color|xterm-kitty) color_prompt=yes;; | |
| 38 | + | esac | |
| 39 | + | ||
| 40 | + | if [ -n "$force_color_prompt" ]; then | |
| 41 | + | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
| 42 | + | # We have color support; assume it's compliant with Ecma-48 | |
| 43 | + | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
| 44 | + | # a case would tend to support setf rather than setaf.) | |
| 45 | + | color_prompt=yes | |
| 46 | + | else | |
| 47 | + | color_prompt= | |
| 48 | + | fi | |
| 49 | + | fi | |
| 50 | + | ||
| 51 | + | if [ "$color_prompt" = yes ]; then | |
| 52 | + | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
| 53 | + | else | |
| 54 | + | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
| 55 | + | fi | |
| 56 | + | unset color_prompt force_color_prompt | |
| 57 | + | ||
| 58 | + | # If this is an xterm set the title to user@host:dir | |
| 59 | + | case "$TERM" in | |
| 60 | + | xterm*|rxvt*) | |
| 61 | + | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | |
| 62 | + | ;; | |
| 63 | + | *) | |
| 64 | + | ;; | |
| 65 | + | esac | |
| 66 | + | ||
| 67 | + | # enable color support of ls and also add handy aliases | |
| 68 | + | if [ -x /usr/bin/dircolors ]; then | |
| 69 | + | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
| 70 | + | alias ls='ls --color=auto' | |
| 71 | + | alias grep='grep --color=auto' | |
| 72 | + | fi | |
| 73 | + | ||
| 74 | + | # enable programmable completion features (you don't need to enable | |
| 75 | + | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
| 76 | + | # sources /etc/bash.bashrc). | |
| 77 | + | if ! shopt -oq posix; then | |
| 78 | + | if [ -f /usr/share/bash-completion/bash_completion ]; then | |
| 79 | + | . /usr/share/bash-completion/bash_completion | |
| 80 | + | elif [ -f /etc/bash_completion ]; then | |
| 81 | + | . /etc/bash_completion | |
| 82 | + | fi | |
| 83 | + | fi | |
| 84 | + | ||
| 85 | + | ###################################### | |
| 86 | + | # aliases | |
| 87 | + | ###################################### | |
| 88 | + | ||
| 89 | + | # general | |
| 90 | + | ||
| 91 | + | alias icat="kitten icat" | |
| 92 | + | alias bat="batcat" | |
| 93 | + | alias cat="bat --paging=never" | |
| 94 | + | alias rced="micro ~/.bashrc && source ~/.bashrc" | |
| 95 | + | alias ps="ps auxww" | |
| 96 | + | alias copy="xclip -sel clipboard" | |
| 97 | + | alias open="xdg-open" | |
| 98 | + | alias c="clear" | |
| 99 | + | alias updupgr="sudo apt update && sudo apt upgrade" | |
| 100 | + | alias unfuckwifi="sudo systemctl restart NetworkManager" | |
| 101 | + | ||
| 102 | + | # some cd bookmarks | |
| 103 | + | alias dotf="cd /home/kat/dotfiles" | |
| 104 | + | # alias gmine="cd /home/kat/Documents/Git/-mine" | |
| 105 | + | ||
| 106 | + | # git | |
| 107 | + | alias gitall="git remote | xargs -L1 git push --all" | |
| 108 | + | alias gyolo="git add . && git commit -m 'yolo'" | |
| 109 | + | alias gitd="git diff --staged" | |
| 110 | + | alias gitlc="git diff HEAD~" | |
| 111 | + | alias gdiff="gitd" | |
| 112 | + | alias gits="git status" | |
| 113 | + | alias gita="git add ." | |
| 114 | + | ||
| 115 | + | ###################################### | |
| 116 | + | # variables | |
| 117 | + | ###################################### | |
| 118 | + | ||
| 119 | + | # set truecolor | |
| 120 | + | export COLORTERM=truecolor | |
| 121 | + | export MICRO_TRUECOLOR=1 | |
| 122 | + | ||
| 123 | + | # catppuccin colors for fzf | |
| 124 | + | export FZF_DEFAULT_OPTS=" \ | |
| 125 | + | --color=spinner:#F2D5CF,hl:#E78284 \ | |
| 126 | + | --color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \ | |
| 127 | + | --color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \ | |
| 128 | + | --color=border:#414559,label:#C6D0F5" | |
| 129 | + | ||
| 130 | + | export FZF_CTRL_T_OPTS=" | |
| 131 | + | --walker-skip .git,node_modules,target | |
| 132 | + | --preview 'batcat -n --color=always {}' | |
| 133 | + | --bind 'ctrl-/:change-preview-window(down|hidden|)'" | |
| 134 | + | ||
| 135 | + | export FZF_ALT_C_OPTS=" | |
| 136 | + | --walker-skip .git,node_modules,target | |
| 137 | + | --preview 'tree -C {}'" | |
| 138 | + | ||
| 139 | + | ###################################### | |
| 140 | + | # functions | |
| 141 | + | ###################################### | |
| 142 | + | ||
| 143 | + | # print internal & external IPs | |
| 144 | + | whatip() { | |
| 145 | + | # internal | |
| 146 | + | echo -n "internal IP: " | lolcat -p 0.7 | |
| 147 | + | hostname -I | awk '{print $1}' | |
| 148 | + | ||
| 149 | + | # external | |
| 150 | + | echo -n "external IP: " | lolcat -p 0.7 | |
| 151 | + | curl -4 icanhazip.com | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | # password generator. takes input for password length by number | |
| 155 | + | passgen() { | |
| 156 | + | PASSLENGTH=$(gum input --placeholder "type a number") | |
| 157 | + | date +%s | sha256sum | base64 | head -c "$PASSLENGTH"; echo | |
| 158 | + | } | |
| 159 | + | ||
| 160 | + | cdmess() { | |
| 161 | + | # from this blog post: | |
| 162 | + | # https://blog.larah.me/mess-directory/ | |
| 163 | + | today_tmpdir="${TMPDIR-/tmp}/${USER}_mess/$(date +%F)" | |
| 164 | + | mkdir -p "$today_tmpdir" | |
| 165 | + | cd "$(mktemp -d -p "${today_tmpdir}" XXXX)" || exit 1 | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | # to get quick notifs | |
| 169 | + | # after long commands | |
| 170 | + | notif() { | |
| 171 | + | notify-send "done!" | |
| 172 | + | paplay /usr/share/sounds/sound-icons/start | |
| 173 | + | spd-say -t female3 -r +25 "done!" | |
| 174 | + | } | |
| 175 | + | ||
| 176 | + | # make & cd into a folder | |
| 177 | + | mkcd() { | |
| 178 | + | mkdir -p "$@" && cd "$_" || exit 1; | |
| 179 | + | } | |
| 180 | + | ||
| 181 | + | # shamelessly stolen from evan hahn: | |
| 182 | + | # https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/#audio-and-video-and-pictures | |
| 183 | + | boop() { | |
| 184 | + | local last="$?" | |
| 185 | + | if [[ "$last" == "0" ]]; then | |
| 186 | + | sfx chime | |
| 187 | + | else | |
| 188 | + | sfx bad | |
| 189 | + | fi | |
| 190 | + | eval "$(exit "$last")" | |
| 191 | + | } | |
| 192 | + | ||
| 193 | + | # man by default, fall back to `help` | |
| 194 | + | # for shell functions | |
| 195 | + | # https://lobste.rs/s/fkr3ha/some_terminal_frustrations#c_70wike | |
| 196 | + | man() { | |
| 197 | + | /usr/bin/man "$@" || help "$@" | less | |
| 198 | + | } | |
| 199 | + | ||
| 200 | + | ###################################### | |
| 201 | + | # misc | |
| 202 | + | ###################################### | |
| 203 | + | ||
| 204 | + | eval "$(starship init bash)" | |
| 205 | + | eval "$(fzf --bash)" | |
| 206 | + | eval "$(batman --export-env)" |