dotfiles/bash/.bashrc

46 lines
1 KiB
Bash
Raw Normal View History

2023-07-25 11:45:32 +02:00
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias grep='grep --color=auto'
2023-07-25 13:57:30 +02:00
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
colorize() {
echo -e "\[\033[1;$1\]$2\[\033[0m\]"
2023-07-25 13:57:30 +02:00
}
PS1='['
2023-07-25 17:04:11 +02:00
PS1+=$(colorize '92m' '\u@\h')
2023-07-25 13:57:30 +02:00
PS1+=':'
2023-07-25 17:04:11 +02:00
PS1+=$(colorize '94m' '\w')
2023-07-25 13:57:30 +02:00
PS1+=']'
PS1+=$(colorize '93m' '$(parse_git_branch)')
PS1+='\$ '
2023-07-25 11:45:32 +02:00
# Configure GPG
# This is needed to sign git commits
export GPG_TTY=$(tty)
# Configure editor
export VISUAL="$(command -v nvim 2>/dev/null)"
export EDITOR="$(command -v nvim 2>/dev/null || command -v vim 2>/dev/null || command -v nano)"
2024-01-17 18:35:10 +01:00
[ -x "$(command -v nvim 2> /dev/null)" ] && alias vim='nvim'
2024-03-06 18:53:18 +01:00
[ -x "$(command -v neovide 2> /dev/null)" ] && alias nvim='neovide'
2023-07-25 11:45:32 +02:00
2024-02-27 20:50:24 +01:00
# Haskell
2023-07-25 11:45:32 +02:00
[ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" # ghcup-env
2023-09-26 21:21:34 +02:00
# NodeJS
2024-02-27 20:50:24 +01:00
export npm_config_prefix="$HOME/.local" # This is where global packages are installed
export PATH="$HOME/.local/bin:$PATH"
2024-02-27 20:50:24 +01:00
# Nix
export PATH="$HOME/.nix-profile/bin:$PATH"