add bashrc

This commit is contained in:
odrling 2023-11-27 18:42:25 +01:00
parent ef05a47a8b
commit aa6931ca8e
No known key found for this signature in database
GPG key ID: E24CA7508C27AF5B
5 changed files with 95 additions and 16 deletions

71
.bashrc Normal file
View file

@ -0,0 +1,71 @@
# 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.
[[ $- != *i* ]] && return
## options
bind "set bell-style visible" # don't use sound
bind "set blink-matching-paren on" # blink on matchin parens
bind "set colored-completion-prefix on" # colourz!
bind "set colored-stats on" # colors
bind "set completion-ignore-case on" # ignore case when completing
bind "set completion-map-case on" # treat - and _ the same
bind "set history-size 1048576" # big history
bind "set menu-complete-display-prefix on"
bind "set show-all-if-ambiguous on" # show everything
bind "set show-all-if-unmodified on" # show it!
shopt -s autocd # automatically cd into directories
shopt -s cdspell # correct minor spelling errors in cd
shopt -s checkhash # try the hashtable first
shopt -s checkjobs # show jobs status before exiting
shopt -s checkwinsize # update term size
shopt -s dirspell # spelling correction on dir names
shopt -s extglob # extended globs
shopt -s globstar # allow to use **
shopt -s histappend # append to history instead of overwriting it
shopt -s histverify # don't execute history, show line before
shopt -s nocaseglob # no case on pathname expansion
shopt -s nocasematch # no case on matching
export HISTCONTROL=ignoredups:ignorespace:erasedups
export HISTFILESIZE=
export HISTIGNORE="&:bg:fg:ls:history:exit:clear:pwd:vi:jobs"
export HISTSIZE=
export HISTTIMEFORMAT="%y/%m/%d %T "
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
## Completions
[ -f /etc/bash_completion ] && . /etc/bash_completion
bind '"\t":menu-complete' # nice menu completion on tab
# doas/sudo command completion
complete -cf sudo
complete -cf doas
# prompt
if command -v starship 2>&1 > /dev/null; then
source <(starship init bash --print-full-init)
fi
# OSC-7
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
. ~/.shaliases
[ -f ~/.bashrc.local ] && . ~/.bashrc.local
true # always succeed

6
.gitignore vendored
View file

@ -8,6 +8,12 @@ Cache
# ignore log files
*log
# aliases
!/.shaliases
# bash config
!/.bashrc
# zsh config files
!/.zshrc
!/.zprofile

View file

@ -34,6 +34,9 @@ export PATH="$HOME/.local/bin:$HOME/.local/odrbin:$PNPM_HOME:$PATH:$HOME/.luaroc
export FZF_DEFAULT_OPTS="-m"
command -v fd > /dev/null && export FZF_DEFAULT_COMMAND="fd"
export GPG_TTY=$(tty)
[ -n "$SSH_CONNECTION" ] && export PINENTRY_USER_DATA="USE_CURSES=1"
[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ] && . "$HOME/.nix-profile/etc/profile.d/nix.sh"
if test -z "${XDG_RUNTIME_DIR}"; then

14
.shaliases Normal file
View file

@ -0,0 +1,14 @@
alias venv="source ~/.venvs/venv/bin/activate"
alias ytdl="yt-dlp"
alias ag="ag --nogroup"
alias s="vi ~/.local/bin/\$(stest -lx ~/.local/bin | fzf --tac -e)"
alias ffmpeg="ffmpeg -hide_banner"
alias ffprobe="ffprobe -hide_banner"
alias fd="fd --hidden"
alias ls="ls --color=auto"
alias dns="dig +short"
alias fm=clifm
alias tb="nc termbin.com 9999"
alias neovide="neovide --nofork"
command -v direnv > /dev/null && alias doas="direnv exec ~ doas"

17
.zshrc
View file

@ -78,22 +78,7 @@ setopt appendhistory notify histexpiredupsfirst histsavenodups \
unsetopt beep
alias venv="source ~/.venvs/venv/bin/activate"
alias ytdl="yt-dlp"
alias ag="ag --nogroup"
alias s="vi ~/.local/bin/\$(stest -lx ~/.local/bin | fzf --tac -e)"
alias ffmpeg="ffmpeg -hide_banner"
alias ffprobe="ffprobe -hide_banner"
alias fd="fd --hidden"
alias ls="ls --color=auto"
alias dns="dig +short"
alias fm=clifm
alias tb="nc termbin.com 9999"
alias neovide="neovide --nofork"
command -v direnv > /dev/null && alias doas="direnv exec ~ doas"
export GPG_TTY=$(tty)
[ -n "$SSH_CONNECTION" ] && export PINENTRY_USER_DATA="USE_CURSES=1"
. ~/.shaliases
[ -f ~/.zshrc.local ] && . ~/.zshrc.local