confix/home-manager/dots/bash.nix
2024-01-15 09:29:09 -08:00

82 lines
2.3 KiB
Nix

{ pkgs, config, ... }:
{
home.file = {
".bash_login" = {
enable = true;
text = ''
[[ -f ~/.bashrc ]] && . ~/.bashrc
if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then
exec river
fi
'';
};
".bash_logout" = {
enable = true;
text = ''
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
'';
};
".bashrc" = {
enable = true;
text = ''
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
set -o vi
unset HISTFILE
# Aliases
alias mkfoo='. $HOME/.local/bin/mkfoo.sh'
alias ed='ed -p "> "'
# Functions
function home() {
cd
clear
}
function search() {
surfraw $(surfraw -elvi | fzf | awk '{print $1;}')
}
function mkcd {
mkdir -p $1
cd $1
}
# fe [FUZZY PATTERN] - Open the selected file with the default editor
# - Bypass fuzzy finder if there's only one match (--select-1)
# - Exit if there's no match (--exit-0)
function fe() {
IFS='
'
files=$(fzf --query="$1" --multi --select-1 --exit-0)
[ -n "$files" ] && "$EDITOR" "$files"
}
# Environmental Variables
# Uncomment the following line if you don't like systemctl's auto-paging feature:
export SYSTEMD_PAGER=
export PS1='\n\u@\h:\w (\j)\n$? \$ '
export BEMENU_OPTS="--tb '#03'\
--tf '#${config.colorScheme.colors.base07}'\
--fb '#${config.colorScheme.colors.base00}'\
--ff '#${config.colorScheme.colors.base07}'\
--nb '#${config.colorScheme.colors.base00}'\
--nf '#${config.colorScheme.colors.base07}'\
--hb '#${config.colorScheme.colors.base02}'\
--hf '#${config.colorScheme.colors.base07}'\
--sb '#${config.colorScheme.colors.base02}'\
--sf '#${config.colorScheme.colors.base07}'\
--scb '#${config.colorScheme.colors.base00}'\
--scf '#${config.colorScheme.colors.base07}'\
--fn 'Comic Mono 12'\
--hp '10'\
--binding 'vim'\
--vim-esc-exits\
--ignorecase\
--no-overlap"
'';
};
};
}