organzie .profile and .bashrc
This commit is contained in:
parent
7bd940d717
commit
007db7e0ce
81
.bashrc
Normal file
81
.bashrc
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# Source global definitions
|
||||||
|
if [ -f /etc/bashrc ]; then
|
||||||
|
. /etc/bashrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
if [[ -v "$VERBOSE" ]]; then
|
||||||
|
echo "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function success() {
|
||||||
|
log "✅ ${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function warn() {
|
||||||
|
log "⚠️ ${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run systemd generators
|
||||||
|
if [[ -f /usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator ]]; then
|
||||||
|
set -o allexport
|
||||||
|
# shellcheck disable=1090
|
||||||
|
source <(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
|
||||||
|
set +o allexport
|
||||||
|
fi
|
||||||
|
|
||||||
|
# User specific environment
|
||||||
|
if ! [[ "$PATH" =~ $HOME/.local/bin:$HOME/bin: ]]; then
|
||||||
|
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# User specific aliases and functions
|
||||||
|
if [ -d ~/.bashrc.d ]; then
|
||||||
|
for rc in ~/.bashrc.d/*; do
|
||||||
|
if [ -f "$rc" ]; then
|
||||||
|
# shellcheck disable=1090
|
||||||
|
. "$rc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
unset rc
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
|
||||||
|
# history control
|
||||||
|
HISTSIZE=10000
|
||||||
|
HISTFILESIZE=$HISTSIZE
|
||||||
|
HISTCONTROL=ignorespace:ignoredups
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
if command -v nvim > /dev/null; then
|
||||||
|
success "setting EDITOR to nvim"
|
||||||
|
export EDITOR=nvim
|
||||||
|
|
||||||
|
success "setting MANPAGER viewer to nvim"
|
||||||
|
export MANPAGER="nvim +Man!"
|
||||||
|
else
|
||||||
|
warn "nvim not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Tools
|
||||||
|
|
||||||
|
# fzf
|
||||||
|
if command -v fzf > /dev/null; then
|
||||||
|
eval "$(fzf "--$(basename "$SHELL")")"
|
||||||
|
success "set up fzf"
|
||||||
|
else
|
||||||
|
warn "fzf not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# starship
|
||||||
|
if command -v starship > /dev/null; then
|
||||||
|
eval "$(starship init "$(basename "$SHELL")")"
|
||||||
|
success "set up starship"
|
||||||
|
else
|
||||||
|
warn "starship not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
alias nview="nvim -R"
|
3
.profile
3
.profile
@ -2,6 +2,7 @@
|
|||||||
if [ -n "$BASH_VERSION" ]; then
|
if [ -n "$BASH_VERSION" ]; then
|
||||||
# include .bashrc if it exists
|
# include .bashrc if it exists
|
||||||
if [ -f "$HOME/.bashrc" ]; then
|
if [ -f "$HOME/.bashrc" ]; then
|
||||||
. "$HOME/.bashrc"
|
# shellcheck disable=SC1090
|
||||||
|
. "$HOME/.bashrc"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user