2024-01-27 21:15:39 +01:00
|
|
|
# ~/.bashrc
|
|
|
|
|
|
|
|
# if not running interactively, don't do anything
|
|
|
|
[ -z "$PS1" ] && return
|
|
|
|
|
|
|
|
# readline
|
|
|
|
bind "set editing-mode vi"
|
2024-05-23 09:38:39 +02:00
|
|
|
bind "set keyseq-timeout 0"
|
2024-01-27 21:15:39 +01:00
|
|
|
bind "set show-mode-in-prompt on"
|
2024-03-01 12:51:18 +01:00
|
|
|
bind "set vi-ins-mode-string \1\e[01;35m\2+\1\e[0m\2"
|
2024-01-27 21:15:39 +01:00
|
|
|
bind "set vi-cmd-mode-string :"
|
|
|
|
|
|
|
|
bind "set keymap vi-command"
|
|
|
|
bind "j:history-substring-search-forward"
|
|
|
|
bind "k:history-substring-search-backward"
|
|
|
|
bind "set keymap vi-insert"
|
|
|
|
bind '"\e[A":history-substring-search-backward'
|
|
|
|
bind '"\e[B":history-substring-search-forward'
|
|
|
|
|
|
|
|
bind "set show-all-if-ambiguous on"
|
|
|
|
bind "set completion-display-width 0"
|
|
|
|
bind "set colored-stats on"
|
|
|
|
bind "set visible-stats on"
|
|
|
|
|
2024-03-01 12:51:18 +01:00
|
|
|
# prompt
|
2024-05-05 17:53:52 +02:00
|
|
|
PS1="\[\e[1m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\[\e[1m\]\$\[\e[0m\] "
|
2024-05-23 09:38:39 +02:00
|
|
|
if [ -z $TERMUX_VERSION ]; then
|
|
|
|
PS1="\[\e[1m\]urosm@trento\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\[\e[1m\]\$\[\e[0m\] "
|
|
|
|
fi
|
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 -AFlh"
|
|
|
|
|
|
|
|
# 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}"
|
|
|
|
}
|
2024-05-23 09:38:39 +02:00
|
|
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }osc7_cwd
|