From 0860db73ae6fd9a6f6347219d820bf026a6b8b91 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 27 Sep 2026 17:38:39 +0200 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- .bashrc | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .bashrc (limited to '.bashrc') diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..e85ef7e --- /dev/null +++ b/.bashrc @@ -0,0 +1,120 @@ +# /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 ! + +# 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 + +# Put your fun stuff here. + +# ignore commands starting with space +export HISTCONTROL=ignorespace +export HISTIGNORE='..:fg:clear:tig:git st::git pushf:git a' +export HISTSIZE=8000 + +# enable bash vi mode +set -o vi +bind -m vi-insert -x '"\C-l": clear' + +readline_insert() { + local output=$(command $* || return) + READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}${output}${READLINE_LINE:$READLINE_POINT}" + READLINE_POINT=$((READLINE_POINT + ${#output})) +} +# triggers git branch fuzzy finder +bind -m vi-command -x '"\C-g\C-b": "readline_insert git fuzzy branches"' +bind -m vi-insert -x '"\C-g\C-b": "readline_insert git fuzzy branches"' +# triggers git commit fuzzy finder +bind -m vi-command -x '"\C-g\C-l": "readline_insert git fuzzy commits"' +bind -m vi-insert -x '"\C-g\C-l": "readline_insert git fuzzy commits"' + +# aliases +alias ..='cd ..' +alias daos='doas ' +alias doas='doas ' +alias l='ls -hl --color' +alias lt=tree +alias vi=nvim + +alias dbx=distrobox +alias eq=equery +alias fd='find . -name' +alias g=git +alias mk=make +alias open=xdg-open +alias poe='vifz /etc/portage/' +alias sshmux='ssh -o RequestTTY=yes -o RemoteCommand="tmux new-session -As $HOSTNAME"' +#alias task='task --trusted-hosts=github.com' +alias tw=timew +alias wlc=wl-copy +alias wlp=wl-paste + +# enable fzf +[ -x "$(command -v fzf)" ] && { + export FZF_CTRL_R_OPTS="--layout=reverse" + export FZF_CTRL_T_OPTS="--layout=reverse" + eval "$(fzf --bash)" + alias vz='vi $(__fzf_select__)' +} +[ -e "$HOME/bin/fzf-git.sh" ] && { + source $HOME/bin/fzf-git.sh + alias gco='_fzf_git_each_ref --no-multi | xargs git checkout' +} + +# enable direnv +[ -x "$(command -v direnv)" ] && eval "$(direnv hook bash)" + +# enable starship +[ -x "$(command -v starship)" ] && eval "$(starship init bash)" + +# enable zoxide +[ -x "$(command -v zoxide)" ] && eval "$(zoxide init bash)" + +# enable atuin +# [ -x "$(command -v atuin)" ] && eval "$(ATUIN_NO_BUILTIN_PREEXEC=1 atuin init bash)" + +# enable todo +[ -x "$(command -v todo)" ] && eval "$(todo hook bash)" + +# enable autowt +[ -x "$(command -v autowt)" ] && eval "$(autowt shell-init bash)" + +# modern terminal stuft +# https://codeberg.org/dnkl/foot/wiki#jumping-between-prompts +prompt_marker() { + printf '\e]133;A\e\\' +} +PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }prompt_marker + +# https://codeberg.org/dnkl/foot/wiki#piping-last-command-s-output +command_done() { + printf '\e]133;D\e\\' +} + +PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }command_done +PS0+='\e]133;C\e\\' + +# 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}" +} +PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%;}; }osc7_cwd -- cgit 1.4.1