nix/config/bash/bashrc

32 lines
1 KiB
Bash

for _hm in "/etc/profiles/per-user/$(id -un)" "$HOME/.nix-profile"; do
[ -f "$_hm/etc/profile.d/hm-session-vars.sh" ] && . "$_hm/etc/profile.d/hm-session-vars.sh" && break
done
unset _hm
shopt -s autocd histappend
HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/bash_history"
HISTSIZE=2000
HISTFILESIZE=2000
HISTCONTROL=ignoreboth:erasedups
export GPG_TTY=$(tty)
export THEME="${THEME:-midnight}"
export FZF_COMPLETION_TRIGGER=';'
export FZF_TMUX=1
eval "$(fzf --bash)"
eval "$(direnv hook bash)"
eval "$(starship init bash)"
eval "$(zoxide init bash)"
fzf-config-widget() {
local selected
selected="$(FZF_CTRL_T_COMMAND="rg --files --hidden $HOME/.config" __fzf_select__)"
READLINE_LINE="${READLINE_LINE:0:READLINE_POINT}$selected${READLINE_LINE:READLINE_POINT}"
READLINE_POINT=$((READLINE_POINT + ${#selected}))
}
bind -m vi-insert -x '"\C-e": fzf-config-widget'
bind -m vi-command -x '"\C-e": fzf-config-widget'
[ -r "$OPAMROOT/opam-init/init.sh" ] && . "$OPAMROOT/opam-init/init.sh" > /dev/null 2> /dev/null