#!/bin/bash case $- in *i*) ;; #interactive *) return ;; esac export GOPATH="$HOME/go" export PATH="$HOME/.local/bin:$PATH:$GOPATH/bin:$HOME/Applications:$HOME/scripts:$HOME/.dotnet/:$HOME/.dotnet/tools/:/usr/local/go/bin/" # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=100000 HISTFILESIZE=200000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # colored GCC warnings and errors export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # Add some custom keybinds bind '"\C-o":"lfcd\n"' bind '"\C-g":"tms\n"' bind '"\C-w":"tms $(pwd)\n"' bind '"\C-n":"zk edit --interactive --sort modified-\n"' bind '"\C-f":"cd $(dirname "$(fzf)")\n"' # use lf to switch directories and bind it to ctrl-o function lfcd() { tmp="$(mktemp -uq)" trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT lf -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" || return fi } # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.config/shell/aliasrc ]; then . ~/.config/shell/aliasrc fi # Enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi set_exit_code() { exit_code=$? [[ $exit_code -eq 0 ]] || printf "%s %s %s" "$(tput setaf 1)" "$exit_code" "$(tput sgr0)" } set_prompt() { PS1_BAT="$(bash-status-bat)" PS1_GIT="$(bash-status-git)" if [ "$PS1_GIT" == "" ]; then PS1_GIT="" else PS1_GIT="$PS1_GIT " fi if [[ -n $(find . -user "$(id -u)" -print -prune -o -prune) ]]; then dir="\[\033[00;36m\]$(pwd | sed -E -e "s|^$HOME|~|" -e 's|^([^/]*/[^/]*/).*(/[^/]*)|\1..\2|')" else dir="\[\033[00;31m\]\w" fi # PS1L="\[\033[00;32m\]\u\[\033[00;34m\]@\[\033[01;32m\]\h \[\033[00m\]$PS1_BAT $dir\[\033[00m\] $PS1_GIT" # PS1R=$(date +"%R:%S") # PS1=$(printf "%*s\r%s\n\[\033[00m\]\$(set_exit_code)-[ " "$(tput cols)" "$PS1R" "$PS1L") PS1="\[\033[00m\]\$(set_exit_code)\[\033[00;32m\]\u\[\033[00;34m\]@\[\033[01;32m\]\h \[\033[00m\]$PS1_BAT $dir\[\033[00m\] $PS1_GIT" } PROMPT_COMMAND=set_prompt # # Pyenv stuff # export PATH="$HOME/.pyenv/bin:$PATH" # eval "$(pyenv init -)" # eval "$(pyenv virtualenv-init -)" # direnv for go # eval "$(direnv hook bash)" [ -f ~/.fzf.bash ] && source ~/.fzf.bash # cargo [[ -s "$HOME/.local/share/cargo/env" ]] && source "/home/solomon/.local/share/cargo/env" #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"