confix/modules/home-manager/bash.nix

127 lines
3.4 KiB
Nix

{ pkgs, config, user, ... }:
{
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 "> "'
alias info='info --vi-keys'
alias matrix="unimatrix -f -l ocCgGkS -s 93"
alias ematrix="unimatrix -c yellow -l 'e'"
# Functions
function ranstr() {
COUNT=$1
head -c $COUNT /dev/random | base64 | head -c $COUNT
}
function get-ssh() {
if [ ! -f $HOME/.ssh/id_ed25519.pub ]; then
ssh-keygen -t ed25519 -C "${user.email}"
fi
cat $HOME/.ssh/id_ed25519.pub
}
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 PS1="\n\u@\h:\w (\j)\n$? \$ "
#export SYSTEMD_PAGER=
#export INPUTRC="$XDG_CONFIG_HOME/inputrc"
#export LIBSEAT_BACKEND=logind
#export BEMENU_OPTS="--fn 'Comic Mono 12'\
# --tb '#6272a4'\
# --tf '#f8f8f2'\
# --fb '#282a36'\
# --ff '#f8f8f2'\
# --nb '#282a36'\
# --nf '#6272a4'\
# --hb '#44475a'\
# --hf '#50fa7b'\
# --sb '#44475a'\
# --sf '#50fa7b'\
# --scb '#282a36'\
# --scf '#ff79c6'\
# --hp '10'\
# --binding 'vim'\
# --vim-esc-exits\
# --ignorecase\
# --no-overlap"
eval "$(zoxide init bash)"
'';
};
};
xdg.configFile = {
"inputrc" = {
enable = true;
executable = true;
text = ''
$include /etc/inputrc
set completion-ignore-case on
set completion-map-case on
set show-all-if-ambiguous on
set show-all-if-unmodified on
set completion-query-items 0
set bell-style none
set blink-matching-paren on
set colored-completion-prefix on
set colored-stats on
set completion-prefix-display-length 5
set menu-complete-display-prefix on
set horizontal-scroll-mode on
set mark-directories on
set skip-completed-text on
set visibile-stats on
$if Bash
set completion-map-case on
$end
"\t": menu-complete
"\e[Z": menu-complete-backward
'';
};
};
}