2021-02-19 20:44:18 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
2021-03-13 01:02:50 +01:00
|
|
|
let
|
|
|
|
cfg = config.my.home.zsh;
|
|
|
|
in
|
2021-02-19 19:44:09 +01:00
|
|
|
{
|
2021-03-13 01:02:50 +01:00
|
|
|
options.my.home.zsh = with lib.my; {
|
|
|
|
enable = mkDisableOption "zsh configuration";
|
|
|
|
};
|
|
|
|
|
|
|
|
config.programs.zsh = lib.mkIf cfg.enable {
|
2021-02-19 19:44:09 +01:00
|
|
|
enable = true;
|
|
|
|
dotDir = ".config/zsh"; # Don't clutter $HOME
|
|
|
|
enableCompletion = true;
|
|
|
|
|
|
|
|
history = {
|
2021-05-12 19:55:59 +02:00
|
|
|
size = 500000;
|
2021-06-23 23:14:01 +02:00
|
|
|
save = 500000;
|
2021-06-23 23:13:39 +02:00
|
|
|
extended = false;
|
2021-02-19 19:44:09 +01:00
|
|
|
ignoreSpace = true;
|
|
|
|
ignoreDups = true;
|
2021-08-25 12:22:21 +02:00
|
|
|
share = false;
|
2021-02-19 20:02:54 +01:00
|
|
|
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
2021-02-19 19:44:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
plugins = with pkgs; [
|
|
|
|
{
|
|
|
|
name = "fast-syntax-highlighting";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zdharma";
|
|
|
|
repo = "fast-syntax-highlighting";
|
|
|
|
rev = "v1.55";
|
|
|
|
sha256 = "sha256-DWVFBoICroKaKgByLmDEo4O+xo6eA8YO792g8t8R7kA=";
|
|
|
|
};
|
|
|
|
}
|
2021-02-19 21:56:21 +01:00
|
|
|
{
|
|
|
|
name = "agkozak-zsh-prompt";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "agkozak";
|
|
|
|
repo = "agkozak-zsh-prompt";
|
|
|
|
rev = "v3.9.0";
|
|
|
|
sha256 = "sha256-VTRL+8ph2eI7iPht15epkLggAgtLGxB3DORFTW5GrhE=";
|
|
|
|
};
|
|
|
|
}
|
2021-02-19 19:44:09 +01:00
|
|
|
];
|
2021-02-19 20:05:15 +01:00
|
|
|
|
|
|
|
# Modal editing is life, but CLI benefits from emacs gymnastics
|
|
|
|
defaultKeymap = "emacs";
|
2021-02-19 20:16:08 +01:00
|
|
|
|
2021-09-30 15:34:16 +02:00
|
|
|
# Make those happen early to avoid doing double the work
|
|
|
|
initExtraFirst =
|
|
|
|
lib.optionalString config.my.home.tmux.enable ''
|
|
|
|
# Launch tmux unless already inside one
|
|
|
|
if [ -z "$TMUX" ]; then
|
|
|
|
exec tmux new-session
|
|
|
|
fi
|
|
|
|
''
|
|
|
|
;
|
|
|
|
|
2021-02-19 20:44:18 +01:00
|
|
|
initExtra = lib.concatMapStrings builtins.readFile [
|
|
|
|
./completion-styles.zsh
|
2021-02-19 22:31:07 +01:00
|
|
|
./extra-mappings.zsh
|
2021-02-19 20:44:18 +01:00
|
|
|
./options.zsh
|
|
|
|
];
|
2021-02-19 21:56:21 +01:00
|
|
|
|
|
|
|
localVariables = {
|
|
|
|
# I like having the full path
|
|
|
|
AGKOZAK_PROMPT_DIRTRIM = 0;
|
|
|
|
# Because I *am* from EPITA
|
|
|
|
AGKOZAK_PROMPT_CHAR = [ "42sh$" "42sh#" ":" ];
|
|
|
|
# Easy on the eyes
|
|
|
|
AGKOZAK_COLORS_BRANCH_STATUS = "magenta";
|
|
|
|
# I don't like moving my eyes
|
|
|
|
AGKOZAK_LEFT_PROMPT_ONLY = 1;
|
|
|
|
};
|
2021-03-30 23:33:42 +02:00
|
|
|
|
|
|
|
shellAliases = {
|
|
|
|
# Sometime `gpg-agent` errors out...
|
|
|
|
reset-agent = "gpg-connect-agent updatestartuptty /bye";
|
|
|
|
};
|
2021-04-07 19:15:03 +02:00
|
|
|
|
|
|
|
# Enable VTE integration when using one of the affected shells
|
|
|
|
enableVteIntegration =
|
|
|
|
builtins.any (name: config.my.home.terminal.program == name) [
|
|
|
|
"termite"
|
|
|
|
];
|
2021-02-19 19:44:09 +01:00
|
|
|
};
|
2021-02-19 19:58:59 +01:00
|
|
|
|
|
|
|
# Fuzzy-wuzzy
|
2021-03-13 01:02:50 +01:00
|
|
|
config.programs.fzf = lib.mkIf cfg.enable {
|
2021-02-19 19:58:59 +01:00
|
|
|
enable = true;
|
|
|
|
enableZshIntegration = true;
|
|
|
|
};
|
2021-02-19 20:31:25 +01:00
|
|
|
|
2021-03-13 01:02:50 +01:00
|
|
|
config.programs.dircolors = lib.mkIf cfg.enable {
|
2021-02-19 20:31:25 +01:00
|
|
|
enable = true;
|
|
|
|
};
|
2021-02-19 19:44:09 +01:00
|
|
|
}
|