dots/.bashrc

97 lines
2.1 KiB
Bash
Raw Normal View History

2020-04-07 22:24:30 +02:00
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2022-10-25 20:54:01 +02:00
# Aliases {{{
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"
2022-10-25 20:54:01 +02:00
# }}}
2020-04-07 22:24:30 +02:00
2022-10-25 20:54:01 +02: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
}
2020-04-07 22:24:30 +02:00
2022-10-25 20:54:33 +02:00
PS1="\u \w ❭\[$(tput sgr0)\] "
2022-10-25 20:54:01 +02:00
# Ellipsis when deep in directory
export PROMPT_DIRTRIM=2
2022-10-25 20:54:33 +02:00
export PS1
2022-10-25 20:54:01 +02:00
# }}}
# Path {{{
# Add ~/.bin to PATH
export PATH=~/.bin:$PATH
# }}}
# 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: *"
2022-10-25 20:54:01 +02:00
# }}}
2020-04-07 22:24:30 +02:00
2022-10-25 20:54:01 +02:00
# Man pages {{{
2020-12-10 19:40:55 +01:00
export MANWIDTH=120
2022-10-25 20:54:01 +02:00
# }}}
# Editor {{{
# Set vim as default editor
export EDITOR=nvim
# }}}
2020-12-10 19:40:55 +01:00
2022-10-25 20:54:01 +02:00
# X11 {{{
2021-08-31 14:28:30 +02:00
export XDG_SESSION_TYPE=X11
export XDG_CONFIG_HOME=$HOME/.config
2022-10-25 20:54:01 +02:00
# }}}
# Nix package manager {{{
2022-10-25 20:56:54 +02:00
# Add ~/.nix-profile/bin to PATH
export PATH=~/.nix-profile/bin:$PATH
2022-10-25 20:54:01 +02:00
# }}}
2021-08-31 14:28:30 +02:00
2022-10-25 20:54:01 +02:00
# FZF {{{
2022-10-25 20:56:01 +02:00
# Check if fzf is installed
if [ -f "/usr/bin/fzf" ]; then
# Fuzzy finder setup
export FZF_COMPLETION_TRIGGER='**'
export FZF_DEFAULT_COMMAND='ag --hidden --skip-vcs-ignores -t -g ""'
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'"
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash
_fzf_setup_completion path vim
_fzf_setup_completion path zathura
_fzf_setup_completion path xournalpp
_fzf_setup_completion path nvim
else
echo "fzf not installed"
fi
2022-10-25 20:54:01 +02:00
# }}}
# Node {{{
2022-10-25 20:57:14 +02:00
# Move nvm folder away from home directory
export NVM_DIR="${XDG_CONFIG_HOME}/nvm"
# Pretty much what is in `/usr/share/nvm/init-nvm.sh` but we add the `--no-use`
# flag to `nvm.sh` to make it lazy
source /usr/share/nvm/nvm.sh --no-use
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec
2022-10-25 20:54:01 +02:00
# }}}
# Jupyter {{{
export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
2022-10-25 20:54:01 +02:00
# }}}