summaryrefslogtreecommitdiff
path: root/bashrc
diff options
context:
space:
mode:
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc113
1 files changed, 113 insertions, 0 deletions
diff --git a/bashrc b/bashrc
new file mode 100644
index 0000000..f075b52
--- /dev/null
+++ b/bashrc
@@ -0,0 +1,113 @@
+#
+# ~/.bashrc
+#
+
+[[ $- != *i* ]] && return
+
+[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
+
+# Change the window title of X terminals
+case ${TERM} in
+ xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
+ PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
+ ;;
+ screen*)
+ PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
+ ;;
+esac
+
+use_color=true
+
+# Set colorful PS1 only on colorful terminals.
+# dircolors --print-database uses its own built-in database
+# instead of using /etc/DIR_COLORS. Try to use the external file
+# first to take advantage of user additions. Use internal bash
+# globbing instead of external grep binary.
+safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
+match_lhs=""
+[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
+[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
+[[ -z ${match_lhs} ]] \
+ && type -P dircolors >/dev/null \
+ && match_lhs=$(dircolors --print-database)
+[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
+
+PS1="[\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;85m\]\t\[$(tput sgr0)\]] \[$(tput bold)\]\w\[$(tput sgr0)\] \[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;226m\]\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')\[$(tput sgr0)\] \[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;85m\]\\$\[$(tput sgr0)\] \[$(tput sgr0)\]"
+
+unset use_color safe_term match_lhs sh
+
+alias cp="cp -i" # confirm before overwriting something
+alias df='df -h' # human-readable sizes
+alias clangd="clangd-19" # I always use clangd-19
+alias gti="git" # I misspell git a lot!
+
+xhost +local:root > /dev/null 2>&1
+
+complete -cf sudo
+
+# Bash won't get SIGWINCH if another process is in the foreground.
+# Enable checkwinsize so that bash will check the terminal size when
+# it regains control. #65623
+# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
+shopt -s checkwinsize
+
+shopt -s expand_aliases
+
+# Enable history appending instead of overwriting. #139609
+shopt -s histappend
+
+# Generic extractor
+# # usage: ex <file>
+ex ()
+{
+ if [ -f $1 ] ; then
+ case $1 in
+ *.tar.bz2) tar xjf $1 ;;
+ *.tar.gz) tar xzf $1 ;;
+ *.bz2) bunzip2 $1 ;;
+ *.rar) unrar x $1 ;;
+ *.gz) gunzip $1 ;;
+ *.tar) tar xf $1 ;;
+ *.tbz2) tar xjf $1 ;;
+ *.tgz) tar xzf $1 ;;
+ *.zip) unzip $1 ;;
+ *.Z) uncompress $1;;
+ *.7z) 7z x $1 ;;
+ *) echo "'$1' cannot be extracted via ex()" ;;
+ esac
+ else
+ echo "'$1' is not a valid file"
+ fi
+}
+
+# Git completion
+if [ -f $HOME/.git-completion.bash ]; then
+ . $HOME/.git-completion.bash
+fi
+
+# NVM if it exists
+export NVM_DIR="$HOME/.nvm"
+[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
+[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
+
+# These are special systems to make Mir symbols generation work
+export MIR_SYMBOLS_MAP_GENERATOR_CLANG_SO_PATH=/usr/lib/llvm-19/lib/libclang-19.so.1
+export MIR_SYMBOLS_MAP_GENERATOR_CLANG_LIBRARY_PATH=/usr/lib/llvm-19/lib
+
+# Emsdk for emscripten
+if [ -f ~/Programs/emsdk/emsdk_env.sh ]; then
+ source ~/Programs/emsdk/emsdk_env.sh >/dev/null 2>&1
+fi
+
+# Update path with my scripts and programs directory.
+# Also update the path with my typical path to flutter and pyenv.
+export PATH="${PATH}:$HOME/Scripts:~/Programs:$HOME/Github/flutter/bin:~/.pyenv/versions/3.11.9/bin"
+export PATH="$PATH":"$HOME/.pub-cache/bin"
+export PATH="$HOME/Programs/depot_tools:$HOME/.local/bin:$PATH"
+
+# bun
+export BUN_INSTALL="$HOME/.bun"
+export PATH="$BUN_INSTALL/bin:$PATH"
+
+# Export flutter as an environment variable
+export FLUTTER="$HOME/Github/flutter/bin/flutter"