blob: d1fdee7aa84a5daf2edd5212c8a64edf0428552c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
inputs: {
config,
lib,
pkgs,
...
}:
with inputs.self.lib.theme; let
dominantEscapeCode = fgEscapeCode config.theme.colors.dominant;
in {
nixpkgs.overlays = [
(final: prev: {
zsh = prev.zsh.overrideAttrs (old: {
configureFlags = [
"--enable-maildir-support"
"--enable-multibyte"
"--with-tcsetpgrp"
"--enable-pcre"
"--enable-zshenv=/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9/etc/zshenv"
"--disable-site-fndir"
# "--enable-function-subdirs"
];
});
})
];
programs.zsh = {
enable = true;
interactiveShellInit = with lib; ''
source "${pkgs.grml-zsh-config}/etc/zsh/zshrc"
is4 && xsource "${pkgs.grml-zsh-config}/etc/zsh/keephack"
source "${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh"
function () {
local dominant_escape_code="${dominantEscapeCode}"
local dim_fg_escape_code="${fgEscapeCode config.theme.colors.dimForeground}"
${builtins.readFile ../../dotfiles/zshrc}
autoload -Uz shmart-prompt-dir
zstyle -e ':prompt:grml*:*:items:path' token shmart-prompt-dir
}
# Grml's ZSH config overrides less variables
export ${concatStringsSep " "
(mapAttrsToList
(variable: value: "${variable}=\"${value}\"")
config.programs.less.envVariables)}
'';
# otherwise it'll override the grml prompt
promptInit = "";
# Grml handles that, and supports cache (faster!!!)
enableGlobalCompInit = false;
syntaxHighlighting = {
enable = true;
highlighters = ["main" "brackets" "line"];
};
shellAliases = {
e = "\${(z)EDITOR}";
# Space at the end makes Zsh expand aliases after "sudo"
sudo = "sudo ";
};
setOptions = [
"NO_CASE_GLOB"
"NO_CLOBBER"
];
};
users.defaultUserShell = pkgs.zsh;
home-manager.sharedModules = [
({config, ...}: {
programs.zsh = {
enable = true;
# Completion is already handled by the GRML conf
enableCompletion = false;
history = {
extended = true;
expireDuplicatesFirst = true;
ignoreDups = true;
ignorePatterns = ["run-help *"];
# different, for expireDuplicatesFirst
size = 1100;
save = 1000;
};
# XDG
dotDir = ".config/zsh";
history.path = "${config.xdg.dataHome}/zsh/zsh_history";
plugins = [
{
name = "shmart-prompt-dir";
src = inputs.shmart-prompt-dir;
file = "none";
}
];
};
})
];
}
|