1
0
Fork 0
dot/.bashrc

53 lines
1.2 KiB
Bash
Raw Normal View History

2024-01-27 21:15:39 +01:00
# ~/.bashrc
# if not running interactively, don't do anything
[ -z "$PS1" ] && return
2024-03-01 12:51:18 +01:00
# prompt
2024-07-07 22:13:55 +02:00
PS1="\[\033[01m\]\u@\h:\[\e[01;34m\]\w\[\e[37m\]\$\[\e[00m\] "
2024-03-01 12:51:18 +01:00
# title
PS1="\[\e]0;\u@\h:\w\a\]$PS1"
2024-01-27 21:15:39 +01:00
# alias
alias q="exit"
2024-02-11 10:26:23 +01:00
alias diff="diff --color=auto"
2024-01-27 21:15:39 +01:00
alias grep="grep --color=auto"
alias ls="ls --color=auto"
alias ll="ls -AF1"
alias lll="ls -AFl"
2024-06-12 00:46:44 +02:00
# history
HISTCONTROL="ignoreboth:erasedups"
2024-09-21 18:04:36 +02:00
HISTFILESIZE=-1
HISTSIZE=-1
HISTIGNORE="q"
shopt -s histappend
PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%;}; }"history -a; history -c; history -r;"
2024-01-27 21:15:39 +01:00
# bash completion
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# osc7
osc7_cwd() {
local strlen=${#PWD}
local encoded=""
local pos c o
for (( pos=0; pos<strlen; pos++ )); do
c=${PWD:$pos:1}
case "$c" in
[-/:_.!\'\(\)~[:alnum:]] ) o="${c}" ;;
* ) printf -v o '%%%02X' "'${c}" ;;
esac
encoded+="${o}"
done
printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}"
}
PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%;}; }osc7_cwd