summaryrefslogtreecommitdiff
path: root/modules/zsh.nix
blob: bd7a30ff7dbbc71bdf20b661b546960b21760d32 (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
{
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    enableAutosuggestions = true;
    dotDir = ".zsh";
    history = {
      ignoreAllDups = true;
      path = "$HOME/.zsh/history";
    };
    initExtra = ''
      zstyle ':completion:*' menu select
      zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
      zmodload zsh/complist
      bindkey -M menuselect 'h' vi-backward-char
      bindkey -M menuselect 'k' vi-up-line-or-history
      bindkey -M menuselect 'l' vi-forward-char
      bindkey -M menuselect 'j' vi-down-line-or-history
      bindkey '^f' autosuggest-accept
      source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
      zvm_after_init_commands+=('source ${pkgs.fzf}/share/fzf/completion.zsh && source ${pkgs.fzf}/share/fzf/key-bindings.zsh')
    '';
    shellAliases = {
      ".." = "cd ..";
      l = "ls --color -al";
      ls = "ls --color";
      v = "nvim";
      o = "xdg-open";
      t = "tmux";
      f = "lf";
      tf = "terraform";
      k = "kubectl";
      gst = "git status --short";
      ga = "git add";
      gp = "git push";
      gl = "git log --oneline --decorate --graph";
      gc = "git commit -v -S";
      gd = "git diff --minimal";
    };
    plugins = [
      {
        name = "pure";
        src = pkgs.fetchFromGitHub {
          owner = "sindresorhus";
          repo = "pure";
          rev = "v1.22.0";
          sha256 = "177vabhvgrxdcwvc29rmfmfr96wl75hrkhymnd8qcaky2v4047jd";
        };
      }
    ];
  };
}