61 lines
2.0 KiB
Bash

#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
#alias ls='ls --color=auto'
#PS1="\W:\$ "
export PS1="󰣇 \[$(tput setaf 6)\]\W \[$(tput sgr0)\] "
export SUDO_EDITOR="subl -w"
bind 'set show-all-if-ambiguous on'
bind 'TAB:menu-complete'
#bind 'Space:magic-space'
# ctrl+r replacement with hstr
bind '"\C-r": "\e^ihstr -- \n"'
alias ssh="kitty +kitten ssh"
alias l="lsd -lh --group-dirs first --size short"
#alias ls="lsd"
alias ffs='sudo "$BASH" -c "$(history -p !!)"'
alias cd..="cd .."
alias orphans='[[ -n $(pacman -Qdt) ]] && sudo pacman -Rs $(pacman -Qdtq) || echo "no orphans to remove"'
# HSTR configuration - add this to ~/.bashrc
alias hh=hstr # hh to be alias for hstr
export HSTR_CONFIG=hicolor # get more colors
shopt -s histappend # append new history items to .bash_history
export HISTCONTROL=ignorespace # leading space hides commands from history
export HISTFILESIZE=10000 # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
function hstrnotiocsti {
{ READLINE_LINE="$( { </dev/tty hstr ${READLINE_LINE}; } 2>&1 1>&3 3>&- )"; } 3>&1;
READLINE_POINT=${#READLINE_LINE}
}
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrnotiocsti"'; fi
export HSTR_TIOCSTI=n
# fancy git prompt
# https://github.com/magicmonty/bash-git-prompt
if [ -f "/lib/bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_START=" _LAST_COMMAND_INDICATOR_ ${Cyan}\W${ResetColor}"
GIT_PROMPT_END="  "
source /lib/bash-git-prompt/gitprompt.sh
fi
# set PATH so it includes user's private ~/.local/bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi