-
Notifications
You must be signed in to change notification settings - Fork 0
/
zsh.nix
58 lines (55 loc) · 1.38 KB
/
zsh.nix
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
{
config,
lib,
pkgs,
...
}:
let
cfg = config.home.sweet;
in
lib.mkIf cfg.enable {
programs.zsh = lib.mkIf config.programs.zsh.enable {
enableCompletion = true;
syntaxHighlighting.enable = true;
autocd = true;
# https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html
defaultKeymap = "emacs";
dotDir = ".config/zsh";
history.path = "$HOME/.config/zsh/.zsh_history";
# set prompt
initExtraFirst = lib.mkIf (!config.programs.starship.enable) ''
autoload -Uz promptinit
promptinit
prompt walters
'';
initExtra = builtins.readFile ./init.zsh;
dirHashes = { };
plugins = with pkgs; [
{
name = "you-should-use";
src = "${zsh-you-should-use}/share/zsh/plugins/you-should-use";
}
{
name = "zsh-autopair";
file = "autopair.zsh";
src = "${zsh-autopair}/share/zsh/zsh-autopair";
}
];
};
programs.starship =
let
presetsPath =
if cfg.icons then
"${pkgs.starship}/share/starship/presets/nerd-font-symbols.toml"
else
"${pkgs.starship}/share/starship/presets/plain-text-symbols.toml";
preset = builtins.fromTOML (builtins.readFile presetsPath);
in
lib.mkIf config.programs.starship.enable {
settings = preset // {
nix_shell = {
format = "via $symbol";
};
};
};
}