Zsh: Difference between revisions

P rth (talk | contribs)
m Removed thefuck extention: it has been removed from nixpkgs and replaced by pay-respects
DHCP (talk | contribs)
m style fixes
 
Line 13: Line 13:
{{file|/etc/nixos/configuration.nix|nix|
{{file|/etc/nixos/configuration.nix|nix|
<nowiki>
<nowiki>
  programs.zsh.enable = true;
programs.zsh.enable = true;
  users.extraUsers.myuser = {
users.extraUsers.myuser = {
    ...
  ...
    shell = pkgs.zsh;
  shell = pkgs.zsh;
  };
};
</nowiki>
</nowiki>
}}
}}
Line 31: Line 31:
{{file|home.nix|nix|
{{file|home.nix|nix|
<nowiki>
<nowiki>
  home-manager.users.myuser = {
home-manager.users.myuser = {
    programs.zsh.enable = true;
  programs.zsh.enable = true;
  };
};
</nowiki>
</nowiki>
}}
}}
Line 43: Line 43:
{{file|/etc/nixos/configuration.nix|nix|
{{file|/etc/nixos/configuration.nix|nix|
<nowiki>
<nowiki>
  programs.zsh.enable = true;
programs.zsh.enable = true;
</nowiki>
</nowiki>
}}
}}
Line 55: Line 55:
{{file|/etc/nixos/configuration.nix|nix|
{{file|/etc/nixos/configuration.nix|nix|
<nowiki>
<nowiki>
  programs.zsh = {
programs.zsh = {
    enable = true;
  enable = true;
    enableCompletion = true;
  enableCompletion = true;
    autosuggestions.enable = true;
  autosuggestions.enable = true;
    syntaxHighlighting.enable = true;
  syntaxHighlighting.enable = true;


    shellAliases = {
  shellAliases = {
      ll = "ls -l";
    ll = "ls -l";
      edit = "sudo -e";
    edit = "sudo -e";
      update = "sudo nixos-rebuild switch";
    update = "sudo nixos-rebuild switch";
    };
  };


    histSize = 10000;
  histSize = 10000;
    histFile = "$HOME/.zsh_history";
  histFile = "$HOME/.zsh_history";
    setOptions = [
  setOptions = [
      "HIST_IGNORE_ALL_DUPS"
    "HIST_IGNORE_ALL_DUPS"
    ];
  ];
  };
};
</nowiki>
</nowiki>
}}
}}
Line 84: Line 84:
{{file|/etc/nixos/configuration.nix|nix|
{{file|/etc/nixos/configuration.nix|nix|
<nowiki>
<nowiki>
  programs.zsh = {
programs.zsh = {
  enable = true;
  ohMyZsh = {
     enable = true;
     enable = true;
     ohMyZsh = {
     plugins = [
      enable = true;
      "git"
      plugins = [
      "z"
        "git"
    ];
        "z"
    theme = "robbyrussell";
      ];
      theme = "robbyrussell";
    };
   };
   };
};
</nowiki>
</nowiki>
}}
}}
Line 106: Line 106:
{{file|home.nix|nix|
{{file|home.nix|nix|
<nowiki>
<nowiki>
  programs.zsh = {
programs.zsh = {
    enable = true;
  enable = true;
    enableCompletion = true;
  enableCompletion = true;
    autosuggestion.enable = true;
  autosuggestion.enable = true;
    syntaxHighlighting.enable = true;
  syntaxHighlighting.enable = true;


    shellAliases = {
  shellAliases = {
      ll = "ls -l";
    ll = "ls -l";
      edit = "sudo -e";
    edit = "sudo -e";
      update = "sudo nixos-rebuild switch";
    update = "sudo nixos-rebuild switch";
    };
  };


    history.size = 10000;
  history.size = 10000;
    history.ignoreAllDups = true;
  history.ignoreAllDups = true;
    history.path = "$HOME/.zsh_history";
  history.path = "$HOME/.zsh_history";
    history.ignorePatterns = ["rm *" "pkill *" "cp *"];
  history.ignorePatterns = ["rm *" "pkill *" "cp *"];
  };
};
</nowiki>
</nowiki>
}}
}}
Line 233: Line 233:


==== Hide configuration for new users ====
==== Hide configuration for new users ====
Meaning this message:<syntaxhighlight lang="zsh">
Meaning this message:<syntaxhighlight>
This is the Z Shell configuration function for new users,
This is the Z Shell configuration function for new users,
zsh-newuser-install.
zsh-newuser-install.