2020-04-07 22:24:30 +02:00
|
|
|
# If not running interactively, don't do anything
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
2023-02-26 23:38:43 +01:00
|
|
|
source /etc/os-release
|
|
|
|
|
2020-10-30 16:49:22 +01:00
|
|
|
# Load aliases dynamically
|
2022-01-18 13:17:26 +01:00
|
|
|
[ -f "$HOME/.bash_aliases" ] && source "$HOME/.bash_aliases"
|
2020-04-07 22:24:30 +02:00
|
|
|
|
2020-10-30 16:49:22 +01:00
|
|
|
# Add ~/.bin to PATH
|
2020-05-08 18:08:53 +02:00
|
|
|
export PATH=~/.bin:$PATH
|
|
|
|
|
2020-10-30 16:49:22 +01:00
|
|
|
# Prompt
|
2020-05-07 02:10:20 +02:00
|
|
|
get_branch_name() {
|
|
|
|
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|
|
|
|
|| git rev-parse --short HEAD 2>/dev/null \
|
|
|
|
|| echo 'some branch'
|
|
|
|
}
|
|
|
|
get_git_info() {
|
|
|
|
git rev-parse --is-inside-work-tree &>/dev/null || return
|
2021-03-28 10:39:14 +02:00
|
|
|
echo -e " $(get_branch_name)"
|
2020-05-07 02:10:20 +02:00
|
|
|
}
|
2021-03-28 10:39:14 +02:00
|
|
|
export PS1="\u \w ❭\[$(tput sgr0)\] "
|
2020-04-07 22:24:30 +02:00
|
|
|
|
2020-10-30 16:49:22 +01:00
|
|
|
# History
|
2021-12-31 12:44:28 +01:00
|
|
|
export HISTCONTROL=ignoreboth:erasedups
|
2020-08-18 18:20:58 +02:00
|
|
|
export HISTSIZE=500000
|
2022-05-11 01:15:26 +02:00
|
|
|
# Omit `clear, ls...`; commands prepended with space
|
2021-12-31 12:44:28 +01:00
|
|
|
export HISTIGNORE="clear:l: *"
|
2020-04-07 22:24:30 +02:00
|
|
|
|
2022-05-11 01:15:26 +02:00
|
|
|
# Man pages
|
2020-12-10 19:40:55 +01:00
|
|
|
export MANWIDTH=120
|
|
|
|
|
|
|
|
# Vim
|
2022-05-11 01:19:26 +02:00
|
|
|
export EDITOR=vim
|
2020-10-30 16:49:22 +01:00
|
|
|
|
2020-12-10 19:38:24 +01:00
|
|
|
# Fuzzy finder setup
|
2022-01-27 11:06:32 +01:00
|
|
|
export FZF_COMPLETION_TRIGGER='**'
|
2020-05-08 19:54:20 +02:00
|
|
|
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -t -g ""'
|
2022-05-11 01:16:28 +02:00
|
|
|
export FZF_DEFAULT_OPTS="
|
|
|
|
--pointer="❭"
|
|
|
|
--height 10%
|
|
|
|
--color=fg:-1,bg:-1"
|
|
|
|
export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}"
|
|
|
|
export FZF_CTRL_T_OPTS="--preview='bat {} | head -500'"
|
2023-02-26 23:38:43 +01:00
|
|
|
|
|
|
|
if [[ $ID == "raspbian" ]]; then
|
|
|
|
source /usr/share/doc/fzf/examples/completion.bash
|
|
|
|
source /usr/share/doc/fzf/examples/key-bindings.bash
|
|
|
|
elif [[ $ID == "arch" ]]; then
|
|
|
|
source /usr/share/fzf/completion.bash
|
|
|
|
source /usr/share/fzf/key-bindings.bash
|
|
|
|
fi
|
|
|
|
|
|
|
|
_fzf_setup_completion path vimn zathura xournalpp
|
2020-05-13 19:05:27 +02:00
|
|
|
|
2020-10-30 16:49:22 +01:00
|
|
|
# Nvm
|
2021-08-31 14:28:09 +02:00
|
|
|
export PATH=~/.nvm/versions/node/v14.16.0/bin:$PATH
|
|
|
|
export NVM_DIR="$HOME/.nvm"
|
|
|
|
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" --no-use
|
|
|
|
|
2022-05-11 01:15:26 +02:00
|
|
|
# X11
|
2021-08-31 14:28:30 +02:00
|
|
|
export XDG_SESSION_TYPE=X11
|
|
|
|
|
2022-05-11 01:17:33 +02:00
|
|
|
# Jupyter
|
|
|
|
export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
|
|
|
|
|
2021-08-23 17:13:38 +02:00
|
|
|
# Ellipsis when deep in directory
|
|
|
|
export PROMPT_DIRTRIM=2
|