Files
nix/dots/.bashrc
T
hektor 3c97d0a21f
check / lint (push) Successful in 14s
refactor(shell): nixify 'fzf' config
2026-08-23 13:32:24 +02:00

81 lines
2.0 KiB
Bash

# shellcheck shell=bash
# shellcheck disable=SC1091,SC1090
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
. /etc/os-release
# Prompt configuration
[ -f "$HOME/.bashrc.d/prompt" ] && . "$HOME/.bashrc.d/prompt"
# Aliases {{{
# Load aliases dynamically
[ -f "$HOME/.bash_aliases/all" ] && . "$HOME/.bash_aliases/all"
[ -f "$HOME/.bash_aliases/hosts/$HOSTNAME" ] && . "$HOME/.bash_aliases/hosts/$HOSTNAME"
[ -f "$HOME/.bash_aliases/private" ] && . "$HOME/.bash_aliases/private"
[ -f "$HOME/.bash_aliases/lang-js" ] && . "$HOME/.bash_aliases/lang-js"
# Completions {{{
[ -d "$HOME/.bash_completions" ] && for file in "$HOME/.bash_completions"/*; do
[ -f "$file" ] && . "$file"
done
# }}}
# Host-specific and private configurations
[ -f "$HOME/.bashrc.d/hosts/$HOSTNAME" ] && . "$HOME/.bashrc.d/hosts/$HOSTNAME"
[ -f "$HOME/.bashrc.d/private" ] && . "$HOME/.bashrc.d/private"
# }}}
# Prompt {{{
[ -f "$HOME/.bashrc.d/prompt" ] && . "$HOME/.bashrc.d/prompt"
# }}}
# X11 {{{
export XDG_SESSION_TYPE=X11
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share
# }}}
# FZF {{{
# Check if fzf is installed
if [ -f "/usr/bin/fzf" ]; then
if [[ $ID == "raspbian" ]]; then
. /usr/share/doc/fzf/examples/completion.bash
. /usr/share/doc/fzf/examples/key-bindings.bash
elif [[ $ID == "arch" ]]; then
. /usr/share/fzf/completion.bash
. /usr/share/fzf/key-bindings.bash
fi
_fzf_setup_completion path vim zathura xournalpp nvim mpv
else
echo "fzf not installed"
fi
# }}}
# Jupyter {{{
export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
# }}}
# Conda {{{
[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && . /opt/miniconda3/etc/profile.d/conda.sh
# }}}
# Zettelkasten {{{
export ZK_PATH="$HOME/.zk"
# Codi
# Usage: codi [filetype] [filename]
codi() {
local syntax="${1:-python}"
shift
nvim -c \
"let g:startify_disable_at_vimenter = 1 |\
set bt=nofile ls=0 noru nonu nornu |\
hi ColorColumn ctermbg=NONE |\
hi VertSplit ctermbg=NONE |\
hi NonText ctermfg=0 |\
Codi $syntax" "$@"
}