Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

programs.zsh.enable

Whether to enable Z shell (Zsh).

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.enableCompletion

Enable zsh completion. Don’t forget to add

  environment.pathsToLink = [ "/share/zsh" ];

to your system configuration to get completion for system packages (e.g. systemd).

Type: boolean

Default:

true

Declared by:

programs.zsh.enableVteIntegration

Whether to enable integration with terminals using the VTE library. This will let the terminal track the current working directory.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.package

The zsh package to use.

Type: package

Default:

pkgs.zsh

Declared by:

programs.zsh.antidote.enable

Whether to enable antidote - a zsh plugin manager.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.antidote.package

The antidote package to use.

Type: null or package

Default:

pkgs.antidote

Declared by:

programs.zsh.antidote.plugins

List of antidote plugins.

Type: list of string

Default:

[ ]

Example:

[
  "zsh-users/zsh-autosuggestions"
]

Declared by:

programs.zsh.antidote.useFriendlyNames

Whether to enable friendly names.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.autocd

Automatically enter into a directory if typed directly into shell.

Type: null or boolean

Default:

null

Declared by:

programs.zsh.autosuggestion.enable

Enable zsh autosuggestions

Type: boolean

Default:

false

Declared by:

programs.zsh.autosuggestion.highlight

Custom styles for autosuggestion highlighting. See zshzle(1) for syntax.

Type: null or string

Default:

null

Example:

"fg=#ff00ff,bg=cyan,bold,underline"

Declared by:

programs.zsh.autosuggestion.strategy

ZSH_AUTOSUGGEST_STRATEGY is an array that specifies how suggestions should be generated. The strategies in the array are tried successively until a suggestion is found. There are currently three built-in strategies to choose from:

  • history: Chooses the most recent match from history.
  • completion: Chooses a suggestion based on what tab-completion would suggest. (requires zpty module)
  • match_prev_cmd: Like history, but chooses the most recent match whose preceding history item matches the most recently executed command. Note that this strategy won’t work as expected with ZSH options that don’t preserve the history order such as HIST_IGNORE_ALL_DUPS or HIST_EXPIRE_DUPS_FIRST.

Setting the option to an empty list [] will make ZSH_AUTOSUGGESTION_STRATEGY not be set automatically, allowing the variable to be declared in programs.zsh.localVariables or programs.zsh.sessionVariables

Type: list of (one of “history”, “completion”, “match_prev_cmd”)

Default:

[
  "history"
]

Declared by:

programs.zsh.cdpath

List of paths to autocomplete calls to cd.

Type: list of string

Default:

[ ]

Declared by:

programs.zsh.completionInit

Initialization commands to run when completion is enabled.

Type: strings concatenated with “\n”

Default:

"autoload -U compinit && compinit"

Declared by:

programs.zsh.defaultKeymap

The default base keymap to use.

Type: null or one of “emacs”, “vicmd”, “viins”

Default:

null

Example:

"emacs"

Declared by:

programs.zsh.dirHashes

An attribute set that adds to named directory hash table.

Type: attribute set of string

Default:

{ }

Example:

{
  docs  = "$\{config.home.homeDirectory}/Documents";
  vids  = "$\{config.home.homeDirectory}/Videos";
  dl    = "$\{config.home.homeDirectory}/Downloads";
}

Declared by:

programs.zsh.dotDir

Directory where the zsh configuration and more should be located, relative to the users home directory. The default is the home directory.

Type: null or string

Default:

if config.xdg.enable && lib.versionAtLeast config.home.stateVersion "26.05" then
  "${config.xdg.configHome}/zsh"
else
  config.home.homeDirectory

Example:

"${config.xdg.configHome}/zsh"

Declared by:

programs.zsh.envExtra

Extra commands that should be added to .zshenv.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.zsh.fastSyntaxHighlighting

Options related to zsh-fast-syntax-highlighting.

Type: submodule

Default:

{ }

Declared by:

programs.zsh.fastSyntaxHighlighting.enable

Whether to enable zsh fast syntax highlighting.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.fastSyntaxHighlighting.package

The zsh-fast-syntax-highlighting package to use.

Type: package

Default:

pkgs.zsh-fast-syntax-highlighting

Declared by:

programs.zsh.fastSyntaxHighlighting.settings

Custom values to add to FAST_HIGHLIGHT, like custom chroma configuration (see upstream’s documentation and its built-in chromas).

Type: attribute set of string

Default:

{ }

Example:

{
  "chroma-," = "→chroma/-precommand.ch";
  chroma-comma = "→chroma/-precommand.ch";
  use_brackets = "0";
}

Declared by:

programs.zsh.fastSyntaxHighlighting.theme

If non-null, Home Manager will run fast-theme -q with this value to select the theme. fast-theme persists the selected theme in fast-syntax-highlighting’s work directory, so setting this option back to null stops Home Manager from invoking fast-theme but does not reset an already persisted theme. Run fast-theme -r manually to clear upstream state.

See upstream’s documentation

Type: null or string

Default:

null

Example:

"clean"

Declared by:

programs.zsh.history

Options related to commands history configuration.

Type: submodule

Default:

{ }

Declared by:

programs.zsh.history.append

If set, zsh sessions will append their history list to the history file, rather than replace it. Thus, multiple parallel zsh sessions will all have the new entries from their history lists added to the history file, in the order that they exit.

This file will still be periodically re-written to trim it when the number of lines grows 20% beyond the value specified by programs.zsh.history.save.

Type: boolean

Default:

false

Declared by:

programs.zsh.history.expireDuplicatesFirst

Expire duplicates first.

Type: boolean

Default:

false

Declared by:

programs.zsh.history.extended

Save timestamp into the history file.

Type: boolean

Default:

false

Declared by:

programs.zsh.history.findNoDups

Do not display a line previously found in the history file.

Type: boolean

Default:

false

Declared by:

programs.zsh.history.ignoreAllDups

If a new command line being added to the history list duplicates an older one, the older command is removed from the list (even if it is not the previous event).

Type: boolean

Default:

false

Declared by:

programs.zsh.history.ignoreDups

Do not enter command lines into the history list if they are duplicates of the previous event.

Type: boolean

Default:

true

Declared by:

programs.zsh.history.ignorePatterns

Do not enter command lines into the history list if they match any one of the given shell patterns.

Type: list of string

Default:

[ ]

Example:

[
  "rm *"
  "pkill *"
]

Declared by:

programs.zsh.history.ignoreSpace

Do not enter command lines into the history list if the first character is a space.

Type: boolean

Default:

true

Declared by:

programs.zsh.history.path

History file location

Type: string

Default:

"`\${config.programs.zsh.dotDir}/.zsh_history`"

Example:

"`\${config.xdg.dataHome}/zsh/zsh_history`"

Declared by:

programs.zsh.history.save

Number of history lines to save.

Type: signed integer

Default:

10000

Declared by:

programs.zsh.history.saveNoDups

Do not write duplicate entries into the history file.

Type: boolean

Default:

false

Declared by:

programs.zsh.history.share

Share command history between zsh sessions.

Type: boolean

Default:

true

Declared by:

programs.zsh.history.size

Number of history lines to keep.

Type: signed integer

Default:

10000

Declared by:

programs.zsh.historySubstringSearch

Options related to zsh-history-substring-search.

Type: submodule

Default:

{ }

Declared by:

programs.zsh.historySubstringSearch.enable

Whether to enable history substring search.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.historySubstringSearch.searchDownKey

The key codes to be used when searching down. The default of ^[[B may correspond to the DOWN key – if not, try $terminfo[kcud1].

Type: (list of string) or string

Default:

[
  "^[[B"
]

Declared by:

programs.zsh.historySubstringSearch.searchUpKey

The key codes to be used when searching up. The default of ^[[A may correspond to the UP key – if not, try $terminfo[kcuu1].

Type: (list of string) or string

Default:

[
  "^[[A"
]

Declared by:

programs.zsh.initContent

Content to be added to .zshrc.

To specify the order, use lib.mkOrder.

Common order values:

  • 500 (mkBefore): Early initialization (replaces initExtraFirst)
  • 550: Before completion initialization (replaces initExtraBeforeCompInit)
  • 1000 (default): General configuration (replaces initExtra)
  • 1500 (mkAfter): Last to run configuration

To specify both content in Early initialization and General configuration, use lib.mkMerge.

e.g.

initContent = let zshConfigEarlyInit = lib.mkOrder 500 “do something”; zshConfig = lib.mkOrder 1000 “do something”; in lib.mkMerge [ zshConfigEarlyInit zshConfig ];

Type: strings concatenated with “\n”

Default:

""

Example:

lib.mkOrder 1200 '''
  echo "Hello zsh initContent!"
''';

Declared by:

programs.zsh.localVariables

Extra local variables defined at the top of .zshrc.

Type: attribute set

Default:

{ }

Example:

{
  POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = [
    "dir"
    "vcs"
  ];
}

Declared by:

programs.zsh.loginExtra

Extra commands that should be added to .zlogin.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.zsh.logoutExtra

Extra commands that should be added to .zlogout.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.zsh.oh-my-zsh

Options to configure oh-my-zsh.

Type: submodule

Default:

{ }

Declared by:

programs.zsh.oh-my-zsh.enable

Whether to enable oh-my-zsh.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.oh-my-zsh.package

The oh-my-zsh package to use.

Type: package

Default:

pkgs.oh-my-zsh

Declared by:

programs.zsh.oh-my-zsh.custom

Path to a custom oh-my-zsh package to override config of oh-my-zsh. See https://github.com/robbyrussell/oh-my-zsh/wiki/Customization for more information.

Type: string

Default:

""

Example:

"\${config.home.homeDirectory}/my_customizations"

Declared by:

programs.zsh.oh-my-zsh.extraConfig

Extra settings for plugins.

Type: strings concatenated with “\n”

Default:

""

Example:

''
  zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github
''

Declared by:

programs.zsh.oh-my-zsh.plugins

List of oh-my-zsh plugins

Type: list of string

Default:

[ ]

Example:

[
  "git"
  "sudo"
]

Declared by:

programs.zsh.oh-my-zsh.theme

Name of the theme to be used by oh-my-zsh.

Type: string

Default:

""

Example:

"robbyrussell"

Declared by:

programs.zsh.plugins

Plugins to source in .zshrc.

Type: list of (submodule)

Default:

[ ]

Example:

[
  {
    name = "enhancd";
    file = "init.sh";
    src = pkgs.fetchFromGitHub {
      owner = "b4b4r07";
      repo = "enhancd";
      rev = "v2.2.1";
      sha256 = "0iqa9j09fwm6nj5rpip87x3hnvbbz9w9ajgm6wkrd5fls8fn8i5g";
    };
  }
{
  name = "wd";
  src = pkgs.zsh-wd;
  file = "share/wd/wd.plugin.zsh";
  functions = [ "share/zsh/site-functions" ];
}
]

Declared by:

programs.zsh.plugins.*.file

The plugin script to source. Required if the script name does not match name.plugin.zsh using the plugin name from the plugin src.

Type: string

Declared by:

programs.zsh.plugins.*.functions

Paths of additional functions to add to fpath.

Type: list of string

Default:

[ ]

Declared by:

programs.zsh.plugins.*.name

The name of the plugin.

Type: string

Declared by:

programs.zsh.plugins.*.src

Path to the plugin folder.

Will be added to fpath and PATH.

Type: absolute path

Declared by:

programs.zsh.prezto

Options to configure prezto.

Type: submodule

Default:

{ }

Declared by:

programs.zsh.prezto.enable

Whether to enable prezto.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.prezto.package

The prezto package to use.

Type: package

Default:

pkgs.zsh-prezto

Declared by:

programs.zsh.prezto.autosuggestions.color

Set the query found color.

Type: null or string

Default:

null

Example:

"fg=blue"

Declared by:

programs.zsh.prezto.caseSensitive

Set case-sensitivity for completion, history lookup, etc.

Type: null or boolean

Default:

true

Example:

true

Declared by:

programs.zsh.prezto.color

Color output (automatically set to false on dumb terminals).

Type: null or boolean

Default:

true

Example:

false

Declared by:

programs.zsh.prezto.completions.ignoredHosts

Set the entries to ignore in static /etc/hosts for host completion.

Type: list of string

Default:

[ ]

Example:

[
  "0.0.0.0"
  "127.0.0.1"
]

Declared by:

programs.zsh.prezto.editor.dotExpansion

Automatically convert .... to ../..

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.editor.keymap

Set the key mapping style to emacs or vi.

Type: null or one of “emacs”, “vi”

Default:

"emacs"

Example:

"vi"

Declared by:

programs.zsh.prezto.editor.promptContext

Allow the Zsh prompt context to be shown.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.extraConfig

Additional configuration to add to .zpreztorc.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.zsh.prezto.extraFunctions

Set the Zsh functions to load (zshcontrib(1)).

Type: list of string

Default:

[ ]

Example:

[
  "zargs"
  "zmv"
]

Declared by:

programs.zsh.prezto.extraModules

Set the Zsh modules to load (zshmodules(1)).

Type: list of string

Default:

[ ]

Example:

[
  "attr"
  "stat"
]

Declared by:

programs.zsh.prezto.git.submoduleIgnore

Ignore submodules when they are dirty, untracked, all, or none.

Type: null or one of “dirty”, “untracked”, “all”, “none”

Default:

null

Example:

"all"

Declared by:

programs.zsh.prezto.gnuUtility.prefix

Set the command prefix on non-GNU systems.

Type: null or string

Default:

null

Example:

"g"

Declared by:

programs.zsh.prezto.historySubstring.foundColor

Set the query found color.

Type: null or string

Default:

null

Example:

"fg=blue"

Declared by:

programs.zsh.prezto.historySubstring.globbingFlags

Set the search globbing flags.

Type: null or string

Default:

null

Declared by:

programs.zsh.prezto.historySubstring.notFoundColor

Set the query not found color.

Type: null or string

Default:

null

Example:

"fg=red"

Declared by:

programs.zsh.prezto.macOS.dashKeyword

Set the keyword used by mand to open man pages in Dash.app.

Type: null or string

Default:

null

Example:

"manpages"

Declared by:

programs.zsh.prezto.pmoduleDirs

Add additional directories to load prezto modules from.

Type: list of absolute path

Default:

[ ]

Example:

[ "${config.home.homeDirectory}/.zprezto-contrib" ]

Declared by:

programs.zsh.prezto.pmodules

Set the Prezto modules to load (browse modules). The order matters.

Type: list of string

Default:

[
  "environment"
  "terminal"
  "editor"
  "history"
  "directory"
  "spectrum"
  "utility"
  "completion"
  "prompt"
]

Declared by:

programs.zsh.prezto.prompt.pwdLength

Set the working directory prompt display length. By default, it is set to short. Set it to long (without ~ expansion) for longer or full (with ~ expansion) for even longer prompt display.

Type: null or one of “short”, “long”, “full”

Default:

null

Example:

"short"

Declared by:

programs.zsh.prezto.prompt.showReturnVal

Set the prompt to display the return code along with an indicator for non-zero return codes. This is not supported by all prompts.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.prompt.theme

Set the prompt theme to load. Setting it to random loads a random theme. Automatically set to off on dumb terminals.

Type: null or string

Default:

"sorin"

Example:

"pure"

Declared by:

programs.zsh.prezto.python.virtualenvAutoSwitch

Auto switch to Python virtualenv on directory change.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.python.virtualenvInitialize

Automatically initialize virtualenvwrapper if pre-requisites are met.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.ruby.chrubyAutoSwitch

Auto switch the Ruby version on directory change.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.screen.autoStartLocal

Auto start a session when Zsh is launched in a local terminal.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.screen.autoStartRemote

Auto start a session when Zsh is launched in a SSH connection.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.ssh.identities

Set the SSH identities to load into the agent.

Type: list of string

Default:

[ ]

Example:

[
  "id_rsa"
  "id_rsa2"
  "id_github"
]

Declared by:

programs.zsh.prezto.syntaxHighlighting.highlighters

Set syntax highlighters. By default, only the main highlighter is enabled.

Type: list of string

Default:

[ ]

Example:

[
  "main"
  "brackets"
  "pattern"
  "line"
  "cursor"
  "root"
]

Declared by:

programs.zsh.prezto.syntaxHighlighting.pattern

Set syntax pattern styles.

Type: attribute set of string

Default:

{ }

Example:

{
  "rm*-rf*" = "fg=white,bold,bg=red";
}

Declared by:

programs.zsh.prezto.syntaxHighlighting.styles

Set syntax highlighting styles.

Type: attribute set of string

Default:

{ }

Example:

{
  builtin = "bg=blue";
  command = "bg=blue";
  function = "bg=blue";
}

Declared by:

programs.zsh.prezto.terminal.autoTitle

Auto set the tab and window titles.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.terminal.multiplexerTitleFormat

Set the multiplexer title format.

Type: null or string

Default:

null

Example:

"%s"

Declared by:

programs.zsh.prezto.terminal.tabTitleFormat

Set the tab title format.

Type: null or string

Default:

null

Example:

"%m: %s"

Declared by:

programs.zsh.prezto.terminal.windowTitleFormat

Set the window title format.

Type: null or string

Default:

null

Example:

"%n@%m: %s"

Declared by:

programs.zsh.prezto.tmux.autoStartLocal

Auto start a session when Zsh is launched in a local terminal.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.tmux.autoStartRemote

Auto start a session when Zsh is launched in a SSH connection.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.tmux.defaultSessionName

Set the default session name.

Type: null or string

Default:

null

Example:

"YOUR DEFAULT SESSION NAME"

Declared by:

programs.zsh.prezto.tmux.itermIntegration

Integrate with iTerm2.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.prezto.utility.safeOps

Enabled safe options. This aliases cp, ln, mv and rm so that they prompt before deleting or overwriting files. Set to no to disable this safer behavior.

Type: null or boolean

Default:

null

Example:

true

Declared by:

programs.zsh.profileExtra

Extra commands that should be added to .zprofile.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.zsh.sessionVariables

Environment variables that will be set for zsh session.

Setting a value to null will skip setting the variable at all, which may be useful when overriding.

Type: lazy attribute set of (null or string or absolute path or signed integer or floating point number or boolean)

Default:

{ }

Example:

{
  MAILCHECK = 30;
}

Declared by:

programs.zsh.setOptions

Configure zsh options. See zshoptions(1).

To unset an option, prefix it with “NO_”.

Type: list of string

Default:

[ ]

Example:

[
  "EXTENDED_HISTORY"
  "RM_STAR_WAIT"
  "NO_BEEP"
]

Declared by:

programs.zsh.shellAliases

An attribute set that maps aliases (the top level attribute names in this option) to command strings or directly to build outputs.

Type: attribute set of string

Default:

{ }

Example:

{
  ".." = "cd ..";
  ll = "ls -l";
}

Declared by:

programs.zsh.shellGlobalAliases

Similar to , but are substituted anywhere on a line.

Type: attribute set of string

Default:

{ }

Example:

{
  G = "| grep";
  UUID = "$(uuidgen | tr -d \\n)";
}

Declared by:

programs.zsh.siteFunctions

Functions that are added to the Zsh environment and are subject to autoloading. The key is the name and the value is the body of the function to be autoloaded.

They are also already marked for autoloading through autoload -Uz.

Type: attribute set of strings concatenated with “\n”

Default:

{ }

Example:

{
  mkcd = ''
    mkdir --parents "$1" && cd "$1"
  '';
}

Declared by:

programs.zsh.syntaxHighlighting

Options related to zsh-syntax-highlighting.

Type: submodule

Default:

{ }

Declared by:

programs.zsh.syntaxHighlighting.enable

Whether to enable zsh syntax highlighting.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.syntaxHighlighting.package

The zsh-syntax-highlighting package to use.

Type: package

Default:

pkgs.zsh-syntax-highlighting

Declared by:

programs.zsh.syntaxHighlighting.highlighters

Highlighters to enable See the list of highlighters: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md

Note: The “main” highlighter is always included automatically. If you’d like to exclude it, please configure with a higher priority using mkForce.

Type: list of string

Default:

"[ \"main\" ]"

Example:

[
  "brackets"
]

Declared by:

programs.zsh.syntaxHighlighting.patterns

Custom syntax highlighting for user-defined patterns. Reference: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md

Type: attribute set of string

Default:

{ }

Example:

{
  "rm -rf *" = "fg=white,bold,bg=red";
}

Declared by:

programs.zsh.syntaxHighlighting.styles

Custom styles for syntax highlighting. See each highlighter style option: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md

Type: attribute set of string

Default:

{ }

Example:

{
  comment = "fg=black,bold";
}

Declared by:

programs.zsh.zplug.enable

Whether to enable zplug - a zsh plugin manager.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.zplug.package

The zplug package to use.

Type: package

Default:

pkgs.zplug

Declared by:

programs.zsh.zplug.plugins

List of zplug plugins.

Type: list of (submodule)

Default:

[ ]

Declared by:

programs.zsh.zplug.plugins.*.name

The name of the plugin.

Type: string

Declared by:

programs.zsh.zplug.plugins.*.tags

The plugin tags.

Type: list of string

Default:

[ ]

Declared by:

programs.zsh.zplug.zplugHome

Path to zplug home directory.

Type: absolute path

Default:

"~/.zplug"

Declared by:

programs.zsh.zprof.enable

Enable zprof in your zshrc.

Type: boolean

Default:

false

Declared by:

programs.zsh.zsh-abbr.enable

Whether to enable zsh-abbr - zsh manager for auto-expanding abbreviations.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.zsh.zsh-abbr.package

The zsh-abbr package to use.

Type: package

Default:

pkgs.zsh-abbr

Declared by:

programs.zsh.zsh-abbr.abbreviations

An attribute set that maps aliases (the top level attribute names in this option) to abbreviations. Abbreviations are expanded with the longer phrase after they are entered.

Type: attribute set of string

Default:

{ }

Example:

{
  gco = "git checkout";
  l = "less";
}

Declared by:

programs.zsh.zsh-abbr.globalAbbreviations

Similar to , but are expanded anywhere on a line.

Type: attribute set of string

Default:

{ }

Example:

{
  G = "| grep";
  L = "| less -R";
}

Declared by: