dotfiles/terminal/.config/bash/bashrc
Marty Oehme acc2496bd6
terminal: Move bash and zsh into config directory
With the power of dotter for dotfile management we can move the files we
want to link anywhere in our repository.

So finally we're making use of it to keep the bash config files in the
`terminal/.config/bash` directory, as well as removing the leading dot
from both the zsh configuration files.
2025-10-13 11:26:22 +02:00

64 lines
1.4 KiB
Bash

#!/usr/bin/env bash
#
# ~/.bashrc
#
# shellcheck disable=SC1090
CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias"
# load additional aliases
if [ -d "$CONFDIR/sh/alias.d" ]; then
for _alias in "$CONFDIR/sh/alias.d"/*.sh; do
. "$_alias"
done
unset _alias
fi
if [ -d "$CONFDIR/bash/alias.d" ]; then
for _alias in "$CONFDIR/bash/alias.d"/*.sh; do
. "$_alias"
done
unset _alias
fi
alias ls='ls --color=auto'
eval "$(starship init bash)"
eval "$(zoxide init bash)"
export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional
source <(carapace _carapace)
set -o vi
stty time 0
bind 'set keyseq-timeout 1'
# insert files with c-t or T in vicmd mode
FZF_CTRL_R_COMMAND="" FZF_ALT_C_COMMAND="" eval "$(fzf --bash)"
builtin bind -m vi-command '"T": "\C-z\C-t\C-z"'
_run-cdi() {
# Get the directory from zoxide query
local dir=$(zoxide query -i)
# If no directory is found, clear the line
if [[ -z "$dir" ]]; then
echo ''
return
fi
# Call cd with the directory
cd -- "$dir"
# Return the exit status of cd
return $?
}
# Make the function _run-cdi available
# shellcheck disable=SC2016
bind -x '"\ec": "`_run-cdi`"'
# shellcheck disable=SC2016
bind -m vi-command -x '"C": "`_run-cdi`"'
eval "$(atuin init bash)"