summaryrefslogtreecommitdiff
path: root/user-profiles/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'user-profiles/zsh')
-rw-r--r--user-profiles/zsh/default.nix104
-rw-r--r--user-profiles/zsh/zshrc7
2 files changed, 77 insertions, 34 deletions
diff --git a/user-profiles/zsh/default.nix b/user-profiles/zsh/default.nix
index daeb7e82..eb9f7aa9 100644
--- a/user-profiles/zsh/default.nix
+++ b/user-profiles/zsh/default.nix
@@ -1,38 +1,76 @@
1{ userName, pkgs, customUtils, lib, config, ... }: 1{ userName, pkgs, customUtils, lib, config, ... }:
2let 2{
3 dotDir = ".config/zsh"; 3 config = {
4 p10kZsh = "${dotDir}/.p10k.zsh"; 4 nixpkgs.externalConfig.allowUnfreePackages = [
5 cfg = config.home-manager.users.${userName}; 5 "zsh-abbr"
6in { 6 ];
7 home-manager.users.${userName} = { 7
8 programs.zsh = { 8 home-manager.users.${userName} = let sysConfig = config; in { config, ... }: {
9 inherit dotDir; 9 config = {
10 enable = true; 10 programs.zsh = {
11 autocd = true; 11 dotDir = "${config.xdg.configHome}/zsh";
12 enableCompletion = true; 12 enable = true;
13 13 autocd = true;
14 plugins = [ 14 enableCompletion = true;
15 { name = "powerlevel10k"; 15 enableVteIntegration = true;
16 file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; 16 history = {
17 src = pkgs.zsh-powerlevel10k; 17 append = true;
18 } 18 expireDuplicatesFirst = true;
19 ]; 19 extended = true;
20 initExtraFirst = '' 20 findNoDups = true;
21 if [[ $TERM == "dumb" ]]; then 21 };
22 unsetopt zle 22 syntaxHighlighting.enable = true;
23 PS1='$ ' 23 zsh-abbr = {
24 return 24 enable = true;
25 fi 25 abbreviations = {
26 ''; 26 re = "systemctl restart";
27 initExtraBeforeCompInit = '' 27 ure = "systemctl --user restart";
28 source "${cfg.home.homeDirectory}/${p10kZsh}" 28 st = "systemctl status";
29 ''; 29 ust = "systemctl --user status";
30 initExtra = lib.mkAfter '' 30 };
31 source ${./zshrc} 31 globalAbbreviations = {
32 source "${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 32 "L" = "| less";
33 ''; 33 "S" = "&> /dev/null";
34 "G" = "| grep";
35 "B" = "&> /dev/null &";
36 "BB" = "&> /dev/null &!";
37 "J" = lib.mkIf config.programs.jq.enable "| jq '.'";
38 };
39 };
40
41 plugins = [
42 { name = "powerlevel10k";
43 file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
44 src = pkgs.zsh-powerlevel10k;
45 }
46 ];
47 initContent = lib.mkMerge [
48 (lib.mkBefore ''
49 if [[ $TERM == "dumb" ]]; then
50 unsetopt zle
51 PS1='$ '
52 return
53 fi
54 '')
55 (lib.mkOrder 550 ''
56 source "$HOME/${config.xdg.configFile."zsh/.p10k.zsh".target}"
57 '')
58 (lib.mkAfter ''
59 source ${./zshrc}
60 '')
61 ];
62 };
63
64 xdg.configFile."zsh/.p10k.zsh".source = ./p10k.zsh;
65 };
34 }; 66 };
35 67
36 home.file.${p10kZsh}.source = ./p10k.zsh; 68 programs.zsh.enable = true;
69 environment.pathsToLink = [ "/share/zsh" ];
70 environment.shellAliases = lib.mkOverride 90 {};
71
72 nixpkgs.externalConfig.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
73 "zsh-abbr"
74 ];
37 }; 75 };
38} 76}
diff --git a/user-profiles/zsh/zshrc b/user-profiles/zsh/zshrc
index a83a8069..af3aca64 100644
--- a/user-profiles/zsh/zshrc
+++ b/user-profiles/zsh/zshrc
@@ -24,7 +24,12 @@ setopt ignore_eof
24bindkey -e 24bindkey -e
25bindkey ';5C' emacs-forward-word 25bindkey ';5C' emacs-forward-word
26bindkey ';5D' emacs-backward-word 26bindkey ';5D' emacs-backward-word
27bindkey '^[[1;5C' emacs-forward-word
28bindkey '^[[1;5D' emacs-backward-word
29bindkey '^H' backward-kill-word
27 30
28autoload -Uz url-quote-magic bracketed-paste-magic 31autoload -Uz url-quote-magic bracketed-paste-magic
29zle -N self-insert url-quote-magic 32zle -N self-insert url-quote-magic
30zle -N bracketed-paste bracketed-paste-magic \ No newline at end of file 33zle -N bracketed-paste bracketed-paste-magic
34
35setopt extended_glob