dots


dots / config
xxwhirlpool  ·  2026-04-09

.bashrc-tokki

  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
 11case $- in
 12    *i*) ;;
 13      *) return;;
 14esac
 15
 16HISTCONTROL=ignoreboth
 17HISTSIZE=1000
 18HISTFILESIZE=2000
 19
 20# append to the history file, don't overwrite it
 21shopt -s histappend
 22
 23# check the window size after each command and, if necessary,
 24# update the values of LINES and COLUMNS.
 25shopt -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)
 31if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
 32    debian_chroot=$(cat /etc/debian_chroot)
 33fi
 34
 35# set a fancy prompt (non-color, unless we know we "want" color)
 36case "$TERM" in
 37    xterm-color|*-256color|xterm-kitty) color_prompt=yes;;
 38esac
 39
 40if [ -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
 49fi
 50
 51if [ "$color_prompt" = yes ]; then
 52    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 53else
 54    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 55fi
 56unset color_prompt force_color_prompt
 57
 58# If this is an xterm set the title to user@host:dir
 59case "$TERM" in
 60xterm*|rxvt*)
 61    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
 62    ;;
 63*)
 64    ;;
 65esac
 66
 67# enable color support of ls and also add handy aliases
 68if [ -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'
 72fi
 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).
 77if ! 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
 83fi
 84
 85######################################
 86# aliases
 87######################################
 88
 89# general
 90
 91alias icat="kitten icat"
 92alias bat="batcat"
 93alias cat="bat --paging=never"
 94alias rced="micro ~/.bashrc && source ~/.bashrc"
 95alias ps="ps auxww"
 96alias copy="xclip -sel clipboard"
 97alias open="xdg-open"
 98alias c="clear"
 99alias updupgr="sudo apt update && sudo apt upgrade"
100alias unfuckwifi="sudo systemctl restart NetworkManager"
101
102# some cd bookmarks
103alias dotf="cd /home/kat/dotfiles"
104# alias gmine="cd /home/kat/Documents/Git/-mine"
105
106# git
107alias gitall="git remote | xargs -L1 git push --all"
108alias gyolo="git add . && git commit -m 'yolo'"
109alias gitd="git diff --staged"
110alias gitlc="git diff HEAD~"
111alias gdiff="gitd"
112alias gits="git status"
113alias gita="git add ."
114
115######################################
116# variables
117######################################
118
119# set truecolor
120export COLORTERM=truecolor
121export MICRO_TRUECOLOR=1
122
123# catppuccin colors for fzf
124export 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
130export 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
135export 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
144whatip() {
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
155passgen() {
156	PASSLENGTH=$(gum input --placeholder "type a number")
157	date +%s | sha256sum | base64 | head -c "$PASSLENGTH"; echo
158}
159
160cdmess() {
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
170notif() {
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
177mkcd() {
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
183boop() {
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
196man() {
197	/usr/bin/man "$@" || help "$@" | less
198}
199
200######################################
201# misc
202######################################
203
204eval "$(starship init bash)"
205eval "$(fzf --bash)"
206eval "$(batman --export-env)"