summaryrefslogtreecommitdiffstats
path: root/zsh-linux.nix
blob: 70524a5e394e52e34588602c180b45144cd1e999 (plain) (blame)
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
{
  config,
  pkgs,
  username,
  ...
}: {
  environment.systemPackages = with pkgs; [
    fzf
  ];

  programs.fzf = {
    keybindings = true;
    fuzzyCompletion = true;
  };

  programs.direnv = {
    enable = true;
    enableZshIntegration = true;
    loadInNixShell = true;
    nix-direnv = {
      enable = true;
    };
    silent = true;
  };

  programs.zoxide = {
    enable = true;
    enableZshIntegration = true;
  };

  programs.zsh = {
    enable = true;
    autosuggestions = {
      enable = true;
      async = true;
      highlightStyle = "fg=cyan";
      strategy = [
        "history"
        "completion"
      ];
    };
    enableBashCompletion = true;
    enableCompletion = true;
    enableGlobalCompInit = true;
    enableLsColors = true;
    syntaxHighlighting = {
      enable = true;
      highlighters = [
        "main"
        "brackets"
        "pattern"
        "cursor"
        "regexp"
        "root"
        "line"
      ];
    };
    vteIntegration = true;
    # enableFzfCompletion = true;
    # enableFzfGit = true;
    # enableFzfHistory = true;
    histFile = "$HOME/.zsh_history";
    histSize = 100000;
    promptInit = ''
      PROMPT=$'%{\e[97m%}[%{\e[m%}%{\e[92m%}%n%{\e[m%}%{\e[32m%}@%{\e[m%}%{\e[92m%}%m%{\e[m%}:%{\e[92m%}%~%{\e[m%}%{\e[97m%}]%{\e[m%}%{\e[97m%}%#%{\e[m%} '
    '';
    interactiveShellInit = ''
      setopt autocd extendedglob nomatch notify

      bindkey -v
      export KEYTIMEOUT=20
    '';
  };

  users.defaultUserShell = pkgs.zsh;
  users.users.${username}.shell = pkgs.zsh;
}