rice/programs/bash.nix

47 lines
1,002 B
Nix
Raw Normal View History

2022-07-22 20:42:05 +00:00
{pkgs, ...}: let
inputrc = pkgs.writeText "inputrc" ''
set completion-ignore-case on
'';
in {
home-manager.users.buffet = {
home.sessionVariables = {
INPUTRC = inputrc;
};
programs.bash = {
enable = true;
historyControl = ["erasedups" "ignorespace"];
shellAliases = {
"cd.." = "cd ..";
ch = "ssh -t irc.buffet.sh -- screen -r weechat";
2022-07-22 20:42:05 +00:00
htop = "htop -t";
mkdir = "mkdir -p";
rg = "rg -S";
};
shellOptions = [
"cdspell"
"checkjobs"
"extglob"
"globstar"
"histappend"
"nocaseglob"
];
initExtra = ''
__prompt() {
case $? in
2022-12-20 13:33:53 +00:00
0) PS1='\[\e[34m\]; \[\e[0m\]' ;;
2022-07-22 20:42:05 +00:00
*) PS1='\[\e[31m\]; \[\e[0m\]' ;;
esac
}
PROMPT_COMMAND="__prompt"
2023-01-06 16:45:36 +00:00
2023-03-06 12:27:46 +00:00
bind '"\C-o": "\C-a\C-k fg; if [[ $? == 1 ]]; then nvim; fi\n"'
2023-01-06 16:45:36 +00:00
bind '"\e\C-m": "\C-e | nvim\C-m"'
2022-07-22 20:42:05 +00:00
'';
};
};
}