# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 is set in /etc/profile, and the default umask is defined
# in /etc/login.defs. You should not need this unless you want different
# defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_COLORS='rs=0:no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=30;44:st=37;44:ex=01;32:'
export LS_OPTIONS='--color=auto'
# eval "$(dircolors)"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -FlA'
alias l='ls $LS_OPTIONS -FA'

# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

stty -ixon 2>/dev/null
shopt -s autocd 2>/dev/null
unset HISTFILE
export LESSHISTFILE='-'

bind "set page-completions Off"
bind TAB:menu-complete
bind Space:magic-space
bind '"\e[Z": menu-complete-backward'
bind '"M-TAB": dynamic-complete-history'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\C-d": kill-whole-line'
bind '"\C-]": dabbrev-expand'
bind '"\C-xa": alias-expand-line'
bind '"\C-xd": dump-macros'
bind '"\C-xe": shell-expand-line'
bind '"\C-x\C-k": kill-whole-line'
bind '"\e.": insert-last-argument'
bind '"\ee": edit-and-execute-command'
bind '"\en": history-substring-search-forward'
bind '"\ep": history-substring-search-backward'
bind '"\eu": undo'
bind '"\C-x\/": "; echo $?"'
bind '"\C-xl": "\C-e | less\C-m"'
bind '"\eH": " --help"'
bind '"\eV": " --version"'

bind '"\eL": "\C-e\|(jq -C . | less -RSX)"'
# copybuffer via OSC52
_copybuffer() {
  # shellcheck disable=SC2312
  printf '\e]52;c;%s\a' "$(printf %s "${READLINE_LINE}" | openssl base64 -A)"
}
bind -x '"\C-o": _copybuffer'

alias b='cat'
alias d='type'
alias ec='echo'
alias rg='rg --smart-case'
alias v='vim -i NONE'
alias vi='vim -i NONE'
alias vim='vim -i NONE'
alias x='exit'

alias bashrc='vim ~/.bashrc'
alias certcat='openssl x509 -text -noout -in'
alias wget='wget --no-hsts'
