2024-01-12 20:59:08 +00:00
|
|
|
{pkgs, ...}: let
|
|
|
|
inputrc = pkgs.writeText "inputrc" ''
|
|
|
|
set completion-ignore-case on
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
home-manager.users.buffet = {
|
|
|
|
home.sessionVariables = {
|
|
|
|
INPUTRC = inputrc;
|
|
|
|
};
|
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
programs = {
|
|
|
|
direnv.enableBashIntegration = true;
|
|
|
|
fzf.enableBashIntegration = true;
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
bash = {
|
|
|
|
enable = true;
|
|
|
|
historyControl = ["erasedups" "ignorespace"];
|
2024-01-12 20:59:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
shellAliases = {
|
|
|
|
e = "\"$EDITOR\"";
|
|
|
|
mkdir = "mkdir -p";
|
|
|
|
rg = "rg -S";
|
|
|
|
update = let
|
|
|
|
change-message = pkgs.writeScript "change-commit-message" ''
|
|
|
|
#!/bin/sh
|
|
|
|
sed -i '1s/.*/chore: update/' "$1"
|
|
|
|
'';
|
|
|
|
in "nix flake update --commit-lock-file && EDITOR=${change-message} git commit --amend";
|
|
|
|
};
|
2024-01-12 20:59:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
shellOptions = [
|
|
|
|
"cdspell"
|
|
|
|
"checkjobs"
|
|
|
|
"extglob"
|
|
|
|
"globstar"
|
|
|
|
"histappend"
|
|
|
|
"nocaseglob"
|
|
|
|
];
|
2024-01-12 20:59:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
bashrcExtra = ''
|
|
|
|
[[ -f ~/.profile ]] && . ~/.profile
|
|
|
|
'';
|
2024-01-29 13:30:45 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
initExtra = ''
|
|
|
|
__prompt() {
|
|
|
|
local status="$?"
|
|
|
|
local row
|
|
|
|
local col
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
IFS=';' read -rs -dR -p $'\e[6n' row col >/dev/tty
|
|
|
|
if [[ $col != 1 ]]; then
|
|
|
|
printf '%s' $'\e[0;7m%\n\e[0m'
|
|
|
|
fi
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
PS1='\[\e[0;1m\]['
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
case $status in
|
|
|
|
0) PS1+='\[\e[32m\]' ;;
|
|
|
|
*) PS1+='\[\e[31m\]' ;;
|
|
|
|
esac
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
if [[ "$PWD" == "$HOME" ]]; then
|
|
|
|
PS1+="~"
|
|
|
|
elif [[ "$PWD" == / ]]; then
|
|
|
|
PS1+=/
|
|
|
|
else
|
|
|
|
PS1+="''${PWD##*/}"
|
|
|
|
fi
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
PS1+='\[\e[0;1m\]]\[\e[0m\]'
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
[[ $CONTAINER_ID ]] && PS1+="'"
|
2024-01-19 14:36:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
PS1+=' '
|
|
|
|
}
|
|
|
|
PROMPT_COMMAND=__prompt
|
2024-01-12 20:59:08 +00:00
|
|
|
|
2024-05-09 15:07:49 +00:00
|
|
|
bind '"\C-o": "\C-a\C-k fg; if [[ $? == 1 ]]; then nvim; fi\n"'
|
|
|
|
bind '"\e\C-m": "\C-e | nvim\C-m"'
|
|
|
|
'';
|
|
|
|
};
|
2024-01-12 20:59:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|