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.fish.enable

Whether to enable fish, the friendly interactive shell.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.fish.package

The fish package to use.

Type: package

Default:

pkgs.fish

Declared by:

programs.fish.binds

Manage key bindings

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  "alt-shift-b".command = "fish_commandline_append bat";
  "alt-s".erase = true;
  "alt-s".operate = "preset";
}

Declared by:

programs.fish.binds.<name>.enable

Whether to enable enable the bind. Set false if you want to ignore the bind.

Type: boolean

Default:

true

Example:

true

Declared by:

programs.fish.binds.<name>.command

command that will be execute

Type: string or list of string (optional when erase is set to true)

Default:

null

Declared by:

programs.fish.binds.<name>.erase

Whether to enable remove bind.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.fish.binds.<name>.mode

Specify the bind mode that the bind is used in

Type: null or one of “default”, “insert”, “paste” or string

Default:

null

Declared by:

programs.fish.binds.<name>.name

The key name that is used for the bind. If null, the attribute set key is used.

Type: null or string

Default:

null

Declared by:

programs.fish.binds.<name>.operate

Operate on preset bindings or user bindings

Type: null or one of “preset”, “user”

Default:

null

Declared by:

programs.fish.binds.<name>.repaint

Whether to enable redraw prompt after command.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.fish.binds.<name>.setsMode

Change current mode after bind is executed

Type: null or one of “default”, “insert”, “paste” or string

Default:

null

Declared by:

programs.fish.binds.<name>.silent

Whether to enable Operate silently.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.fish.completions

Custom fish completions. For more information see https://fishshell.com/docs/current/completions.html.

Type: attribute set of (strings concatenated with “\n” or (submodule))

Default:

{ }

Example:

{
  my-prog = ''
    complete -c myprog -s o -l output
  '';

  my-app = {
    body = ''
      complete -c myapp -s -v
    '';
  };
}

Declared by:

programs.fish.completions.<name>.body

The completion file’s body.

Type: strings concatenated with “\n”

programs.fish.functions

Basic functions to add to fish. For more information see https://fishshell.com/docs/current/cmds/function.html.

Type: attribute set of (strings concatenated with “\n” or (submodule))

Default:

{ }

Example:

{
  __fish_command_not_found_handler = {
    body = "__fish_default_command_not_found_handler $argv[1]";
    onEvent = "fish_command_not_found";
  };

  gitignore = "curl -sL https://www.gitignore.io/api/$argv";
}

Declared by:

programs.fish.functions.<name>.argumentNames

Assigns the value of successive command line arguments to the names given.

Type: null or string or list of string

Default:

null

programs.fish.functions.<name>.body

The function body.

Type: strings concatenated with “\n”

programs.fish.functions.<name>.description

A description of what the function does, suitable as a completion description.

Type: null or string

Default:

null

programs.fish.functions.<name>.inheritVariable

Snapshots the value of the specified variable and defines a local variable with that same name and value when the function is defined.

Type: null or string

Default:

null

programs.fish.functions.<name>.noScopeShadowing

Allows the function to access the variables of calling functions.

Type: boolean

Default:

false

programs.fish.functions.<name>.onEvent

Tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.

Type: null or string or list of string

Default:

null

programs.fish.functions.<name>.onJobExit

Tells fish to run this function when the job with the specified group ID exits. Instead of a PID, the stringer caller can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.

Type: null or string or signed integer

Default:

null

programs.fish.functions.<name>.onProcessExit

Tells fish to run this function when the fish child process with the specified process ID exits. Instead of a PID, for backwards compatibility, %self can be specified as an alias for $fish_pid, and the function will be run when the current fish instance exits.

Type: null or string or signed integer

Default:

null

Example:

"$fish_pid"

programs.fish.functions.<name>.onSignal

Tells fish to run this function when the specified signal is delivered. The signal can be a signal number or signal name.

Type: null or string or signed integer

Default:

null

Example:

[
  "SIGHUP"
  "HUP"
  1
]

programs.fish.functions.<name>.onVariable

Tells fish to run this function when the specified variable changes value.

Type: null or string

Default:

null

programs.fish.functions.<name>.wraps

Causes the function to inherit completions from the given wrapped command.

Type: null or string

Default:

null

programs.fish.generateCompletions

Whether to enable the automatic generation of completions based upon installed man pages.

Type: boolean

Default:

true

Example:

true

Declared by:

programs.fish.interactiveShellInit

Shell script code called during interactive fish shell initialisation.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.fish.loginShellInit

Shell script code called during fish login shell initialisation.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.fish.plugins

The plugins to source in conf.d/99plugins.fish.

Type: list of (submodule)

Default:

[ ]

Example:

[
  {
    name = "z";
    src = pkgs.fetchFromGitHub {
      owner = "jethrokuan";
      repo = "z";
      rev = "ddeb28a7b6a1f0ec6dae40c636e5ca4908ad160a";
      sha256 = "0c5i7sdrsp0q3vbziqzdyqn4fmp235ax4mn4zslrswvn8g3fvdyh";
    };
  }

  # oh-my-fish plugins are stored in their own repositories, which
  # makes them simple to import into home-manager.
  {
    name = "fasd";
    src = pkgs.fetchFromGitHub {
      owner = "oh-my-fish";
      repo = "plugin-fasd";
      rev = "38a5b6b6011106092009549e52249c6d6f501fba";
      sha256 = "06v37hqy5yrv5a6ssd1p3cjd9y3hnp19d3ab7dag56fs1qmgyhbs";
    };
  }
]

Declared by:

programs.fish.plugins.*.name

The name of the plugin.

Type: string

Declared by:

programs.fish.plugins.*.src

Path to the plugin folder.

Relevant pieces will be added to the fish function path and the completion path. The init.fish and key_binding.fish files are sourced if they exist.

Type: absolute path

Declared by:

programs.fish.preferAbbrs

If enabled, abbreviations will be preferred over aliases when other modules define aliases for fish.

Type: boolean

Default:

false

Example:

true

Declared by:

programs.fish.shellAbbrs

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 or (submodule))

Default:

{ }

Example:

{
  "-C" = {
    expansion = "--color";
    position = "anywhere";
  };
  gco = "git checkout";
  l = "less";
}

Declared by:

programs.fish.shellAbbrs.<name>.command

Specifies the command(s) for which the abbreviation should expand. If set, the abbreviation will only expand when used as an argument to the given command(s).

Type: null or string or list of string

Default:

null

programs.fish.shellAbbrs.<name>.expansion

The command expanded by an abbreviation.

Type: null or string

Default:

null

programs.fish.shellAbbrs.<name>.function

The fish function expanded instead of a literal string.

Type: null or string

Default:

null

programs.fish.shellAbbrs.<name>.name

The abbreviation name that is replaced by the expansion.

Type: null or string

Default:

null

programs.fish.shellAbbrs.<name>.position

If the position is “command”, the abbreviation expands only if the position is a command. If it is “anywhere”, the abbreviation expands anywhere.

Type: null or string

Default:

null

Example:

"anywhere"

programs.fish.shellAbbrs.<name>.regex

The regular expression pattern matched instead of the literal name.

Type: null or string

Default:

null

programs.fish.shellAbbrs.<name>.setCursor

The marker indicates the position of the cursor when the abbreviation is expanded. When setCursor is true, the marker is set with a default value of “%”. This Nix option maps to fish’s abbr --set-cursor flag in the generated configuration.

Type: boolean or string

Default:

false

programs.fish.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:

{
  g = "git";
  "..." = "cd ../..";
}

Declared by:

programs.fish.shellInit

Shell script code called during fish shell initialisation.

Type: strings concatenated with “\n”

Default:

""

Declared by:

programs.fish.shellInitLast

Shell script code called during interactive fish shell initialisation, this will be the last thing executed in fish startup.

Type: strings concatenated with “\n”

Default:

""

Declared by: