dots/.bashrc

54 lines
1.3 KiB
Bash
Raw Normal View History

2020-04-07 22:24:30 +02:00
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2020-10-30 16:49:22 +01:00
# Load aliases dynamically
2020-04-07 22:24:30 +02:00
[ -f "$HOME/.aliasrc" ] && source "$HOME/.aliasrc"
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
2020-04-07 22:24:30 +02:00
export HISTCONTROL=ignoreboth
2020-08-18 18:20:58 +02:00
export HISTSIZE=500000
2020-04-07 22:24:30 +02:00
2020-10-30 16:49:22 +01:00
# Readable man pages
2020-12-10 19:40:55 +01:00
export MANWIDTH=120
# Vim
export EDITOR='vim'
2020-10-30 16:49:22 +01:00
2020-12-10 19:38:24 +01:00
# Fuzzy finder setup
2020-05-07 02:10:20 +02:00
source /usr/share/fzf/*.bash
2020-11-01 15:12:15 +01:00
source /usr/share/fzf/key-bindings.bash
2020-05-08 19:54:20 +02:00
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -t -g ""'
2020-11-02 11:55:21 +01:00
export FZF_DEFAULT_OPTS='--height 38% --reverse --border --prompt="❭ " --pointer="❭"'
2020-05-08 19:54:20 +02:00
export FZF_COMPLETION_OPTS='-x'
2020-05-13 19:05:27 +02:00
2020-10-30 16:49:22 +01:00
# Nvm
2020-05-13 19:05:27 +02:00
lazy_load_nvm() {
unset -f nvm node npm npx
export NVM_DIR="$HOME/.nvm"
2020-12-10 19:38:24 +01:00
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
2020-05-13 19:05:27 +02:00
}
2020-12-10 19:38:24 +01:00
nvm() { lazy_load_nvm nvm $@; }
node() { lazy_load_nvm node $@; }
npm() { lazy_load_nvm npm $@; }
npx() { lazy_load_nvm npx $@; }
2021-08-23 17:13:38 +02:00
# Ellipsis when deep in directory
export PROMPT_DIRTRIM=2