# /etc/skel/.bashrc # # This file is sourced by all *interactive* bash shells on startup, # including some apparently interactive shells such as scp and rcp # that can't tolerate any output. So make sure this doesn't display # anything or bad things will happen ! safe_load() { sh="$1" [ -r "$sh" ] && . "$sh" unset sh } prepend_prompt_command() { if [[ ${PROMPT_COMMAND:=} != *${1}* ]]; then PROMPT_COMMAND="${1};${PROMPT_COMMAND#;}" fi } # Test for an interactive shell. There is no need to set anything # past this point for scp and rcp, and it's important to refrain from # outputting anything in those cases. if [[ $- != *i* ]]; then # Shell is non-interactive. Be done now! return fi # enable bash vi mode set -o vi bind -m vi-insert -x '"\C-l": clear' # Append to history file shopt -s histappend #HISTSIZE=50000 #HISTFILESIZE=500000 HISTCONTROL=ignorespace # OSC7 escapte sequence # https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory _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}" } prepend_prompt_command _osc7_cwd # OSC133 command prompt marker # https://codeberg.org/dnkl/foot/wiki#jumping-between-prompts _osc133_marker() { printf '\e]133;A\e\\' } prepend_prompt_command _osc133_marker # set window title _set_win_title() { printf '\033]0;%s\007' "${PWD} (${HOSTNAME}) - FOOT" } prepend_prompt_command _set_win_title # Alias shell commands # alias logout='dbus-send --session --type=method_call --print-reply --dest=' alias ..='cd ..' alias balscp='scp -P 22222 -o User=root -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o Compression=yes' alias balssh='ssh -p 22222 -o User=root -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o Compression=yes' #alias cat=bat alias dao=doas alias daos=doas alias daso=doas alias dosa=doas alias fm=vifm alias g=git alias grep='grep --color=auto' alias k=kubectl alias l='exa --long --classify --group --header --group-directories-first' alias lt='exa --classify --group-directories-first -T' alias nv=nvim alias org='nvim +Orgmode' alias rm=saferm alias rsy=rsyncez alias srv='rclone serve http --addr=0.0.0.0:8080 .' alias ssh='TERM=xterm-256color ssh' alias suspend=loginctl\ suspend alias tt=timetrace alias v=nvim alias vim=nvim alias wlc=wl-copy alias wlp=wl-paste # enable direnv [ -x "$(command -v direnv)" ] && eval "$(direnv hook bash)" # enable navi [ -x "$(command -v navi)" ] && eval "$(navi widget bash)" # enable zoxide [ -x "$(command -v zoxide)" ] && eval "$(zoxide init bash)" # enable starship [ -x "$(command -v starship)" ] && eval "$(starship init bash)" # Use keychain to reuse the ssh-agent and gpg-agent between logins [ -x "$(command -v keychain)" ] && eval "$(keychain --eval --agents ssh,gpg -q id_ed25519)" # AF6AB8C8B10436B9F61293632143BD2AAB94BCC4 # safe_load "$HOME/.keychain/$(hostname)-sh" # safe_load "$HOME/.keychain/$(hostname)-sh-gpg" safe_load /usr/share/fzf/key-bindings.bash