r/fishshell • • 2d ago

Keychain in fish shell

Thumbnail
reddit.com
0 Upvotes

r/fishshell • • 16d ago

Help me understand the switch statement

2 Upvotes

Hello, I'm new to fish shell and linux in general. Please help me understand how the switch statement works.

I'm working on this script where it looks at all the files in the current directory and see if any of them begins with the string "Alpha" or "Bravo", otherwise it just says "not found"

#!/usr/bin/fish

for f in *
    switch f
        case Alpha*
            echo Alpha found
        case Bravo*
            echo Bravo found
        case '*'
            echo not found
    end
end

but right now all I'm getting is "not found" even if files with their names beginning with Alpha or Bravo are there, i.e. I can do a ls Alpha* and they are there.


r/fishshell • • 24d ago

How do I change the color of a comand line (like sudo) in konsole?

Thumbnail
reddit.com
1 Upvotes

r/fishshell • • Oct 23 '26

What prompt do you use?

19 Upvotes

Hey, I'm planning to try out fish as a zsh user. After a quick research, there are 3 that I consider good: hydro, tide and starship (brought from my zsh). I wanted to ask what prompt do you guys use and why


r/fishshell • • Sep 30 '26

File manager written in fish, with fzf providing the UI.

34 Upvotes

Just to see how far I can take the idea.

https://codeberg.org/sitaramc/fzfm

A few downsides (mainly: single-pane. Though there's a notion of an alternate dir and you can do stuff between them). Also, not blazing fast :)

Upsides: Enough that it is my daily driver now. As the README says;

> Imagine looking at the largest files, then cd-ing up one level, or to a different directory, and you now see the largest files *there*.

I'm not looking for users; I kept thinking "wow, fish+fzf is an awesome combo" and wanted to say that to a larger audience.


r/fishshell • • Sep 07 '26

I wasn’t happy with the quality of Fish code generated by agents, so I wrote this skill

0 Upvotes

I wrote a skill for coding agents to help agents write Fish as intended: without bashisms.

It’s also available on skills.sh.


r/fishshell • • Sep 06 '26

Fish 4.9 released with faster tab completion and a Konsole keyboard fix

120 Upvotes

Fish 4.9 is out. Here's what's new:

  • Workaround for a Konsole 26.07.80 Kitty keyboard protocol bug that broke Shift+PageUp. Fish no longer requests the Kitty protocol under Konsole by default. You can re-enable it with the omit-term-workarounds feature flag if you want it back.

  • Faster tab completion in directories with slow-resolving symlinks, like network-mounted files.

  • Abbreviations can now show descriptions right in the completion pager. Shift+Space and Space can now be mapped independently on terminals like Kitty.

  • Vi mode fix for cF and cT commands.

  • List indexing can now be nested in more cases. Several square bracket and variable indexing edge cases got fixed.

  • Built-in help pages now respect an overridden man function.

  • Commands with invalid variable overrides now report an error instead of failing silently.

  • Fixed broken Chinese and Japanese translations for some C library error messages.

  • Fixed read-only variable erasing.

  • Fixed the fg builtin not working on NetBSD.

Official Changelog: https://github.com/fish-shell/fish-shell/releases/tag/4.9.0

Source Linuxiac writeup: https://linuxiac.com/fish-shell-4-9-released-with-faster-tab-completion/


r/fishshell • • Aug 30 '26

fish wrapper for ze.sh: file tracking now available

0 Upvotes

A small follow-up to my earlier post announcing a fish wrapper for the ze directory jumper: ze now has acquired an independent file tracking mode using a separate frecency database for files.

With the fish wrapper this gives you, for example:

ze project        # best-match directory jump
ze -o config      # best-match file open
ze -of config     # fzf-based interactive selection and file open

The file and directory histories are completely independent from each other, and ordinary editor invocations remain untouched.

More details in the announcement on r/zsh


r/fishshell • • Aug 17 '26

made my NixOS management a bit sweeter with this nx helper (fish)

Enable HLS to view with audio, or disable this notification

2 Upvotes

r/fishshell • • Aug 13 '26

Sharing my little QoL config for Fish shell to make life sweeter (NixOS)

13 Upvotes

Config below built for NixOS, but you can convert it for your system

Features:

  • A ton of eza aliases

  • NixOS management commands

  • A couple more aliases

A brief overview of the NixOS managment commands:

Usage: nx <command>

Commands:
 deploy        commit pending changes, then build and switch to the flake
 up            update flake.lock and all packages, then deploy
 clean         garbage-collect the system (nix-collect-garbage -d)
 config        open flake.nix and everything it imports in $EDITOR
 push          commit pending changes and push to the remote
 nuke-history  squash all git history into one "initial commit" and force-push
 doctor        up + clean + push

Regarding nx nuke-history: this command completely removes all commits and creates a single clean commit. I only need this because I just like having a clean git history on my GitHub repository, and I only use git for the convenience of cloning a repository from any device, so I don't need git history.

Here is the config itself:

 programs.fish = {
   enable = true;

   interactiveShellInit = ''
     set -g fish_greeting
   '';

   shellAliases = {
     svim   = "sudo -E vim";
     svi    = "sudo -E vi";
     cat    = "bat -P --theme zenburn";
     "..." = "cd ../..";
     "...." = "cd ../../..";

     # -- eza aliases --

     # basic listings
     ls    = "eza";                        # standard list
     l     = "eza -1";                     # one column
     la    = "eza -1a";                    # one column with hidden files
     ll    = "eza -l";                     # long format
     lla   = "eza -la";                    # long format with hidden files

     # filtered listings
     ld    = "eza -D";                     # directories only
     lld   = "eza -lD";                    # long format, directories only
     lf    = "eza -f";                     # files only
     llf   = "eza -lf";                    # long format, files only

     # sort variants
     lsz   = "eza -l --sort=size";         # sort by size
     lsx   = "eza -l --sort=extension";    # sort by extension
     ltm   = "eza -l --sort=modified";     # sort by modified time
     lcr   = "eza -l --sort=created";      # sort by created time

     # git-aware
     lgit  = "eza -l --git";               # show git status
     lx    = "eza -lbhHigUmuS --git";      # extended info with git

     # tree (default depth 3)
     lt    = "eza --tree --level=3";       # tree, depth 3 by default
     lta   = "eza -a --tree --level=3";    # tree with hidden files, depth 3
     llt   = "eza -l --tree --level=3";    # long tree, depth 3
     llta  = "eza -la --tree --level=3";   # long tree with hidden files, depth 3
   };

   # -- nx: system configuration management --

   functions = {
     __nx_stage = ''
       echo ""
       set_color -o blue
       echo -n "==> "
       set_color normal
       echo "$argv[1]"
     '';

     __nx_diff_dirty = ''
       # -N stages new files by path only (no content), so they show up
       # in the diff below as additions instead of being invisible
       git -C /etc/nixos add -N -A
       git -C /etc/nixos diff
     '';

     __nx_commit_if_dirty = ''
       set -l changes (git -C /etc/nixos status --porcelain)
       if test (count $changes) -gt 0
         __nx_stage "Changes to commit:"
         __nx_diff_dirty
         git -C /etc/nixos add -A
         git -C /etc/nixos commit -m "$argv[1]"
       end
     '';

     __nx_config_files = ''
       # walk the import graph starting at flake.nix, following relative-path
       # nix file references, so new modules are picked up automatically
       set -l root /etc/nixos
       set -l seen $root/flake.nix
       set -l queue $root/flake.nix
       while test (count $queue) -gt 0
         set -l f $queue[1]
         set -e queue[1]
         set -l dir (path dirname $f)
         for rel in (sed -E 's/#.*$//' $f 2>/dev/null | grep -ohE '\.\.?/[A-Za-z0-9_./-]+\.nix')
           set -l full (realpath -m $dir/$rel)
           if not contains $full $seen
             set -a seen $full
             set -a queue $full
           end
         end
       end
       for f in $seen
         echo $f
       end
     '';

     nx = ''
       switch "$argv[1]"
         case deploy
           __nx_stage "Checking for local changes"
           __nx_commit_if_dirty "nx: auto-commit before deploy"
           __nx_stage "Building and switching to the new configuration"
           sudo nixos-rebuild switch --flake /etc/nixos#nixos

         case up
           __nx_stage "Updating flake inputs"
           nix flake update --flake /etc/nixos
           and nx deploy

         case clean
           __nx_stage "Collecting garbage"
           sudo nix-collect-garbage -d

         case config
           __nx_stage "Opening configuration files"
           set -q EDITOR
           or set -l EDITOR vi
           $EDITOR (__nx_config_files)

         case push
           __nx_stage "Checking for local changes"
           __nx_commit_if_dirty "nx: update"
           __nx_stage "Pushing to remote"
           git -C /etc/nixos push

         case nuke-history
           echo "WARNING: this permanently deletes ALL git history in /etc/nixos."
           echo "Every file will be committed fresh as a single \"initial commit\","
           echo "which is then force-pushed, overwriting the remote history too."
           echo "This cannot be undone."
           echo ""
           read -l -P "Continue? [y/N] " confirm
           switch "$confirm"
             case y Y yes Yes YES
               set -l changes (git -C /etc/nixos status --porcelain)
               if test (count $changes) -gt 0
                 __nx_stage "Local changes that will be swept into the new history:"
                 __nx_diff_dirty
               end
               __nx_stage "Squashing history into a single commit"
               set -l branch (git -C /etc/nixos branch --show-current)
               set -l remote (git -C /etc/nixos remote | head -n1)
               git -C /etc/nixos checkout --orphan __nx_nuke_tmp
               and git -C /etc/nixos add -A
               and git -C /etc/nixos commit -m "initial commit"
               and git -C /etc/nixos branch -D $branch
               and git -C /etc/nixos branch -m $branch
               and __nx_stage "Force-pushing rewritten history"
               and git -C /etc/nixos push --force --set-upstream $remote $branch
             case '*'
               echo "Aborted."
           end

         case doctor
           __nx_stage "Running full maintenance cycle (up, clean, push)"
           nx up
           and nx clean
           and nx push

         case '*'
           echo "nx — manage the NixOS configuration in /etc/nixos"
           echo ""
           echo "Usage: nx <command>"
           echo ""
           echo "Commands:"
           echo "  deploy        commit pending changes, then build and switch to the flake"
           echo "  up            update flake.lock and all packages, then deploy"
           echo "  clean         garbage-collect the system (nix-collect-garbage -d)"
           echo "  config        open flake.nix and everything it imports in \$EDITOR"
           echo "  push          commit pending changes and push to the remote"
           echo "  nuke-history  squash all git history into one \"initial commit\" and force-push"
           echo "  doctor        up + clean + push"
       end
     '';
   };

   completions = {
     nx = ''
       complete -c nx -f
       complete -c nx -n __fish_use_subcommand -a deploy -d 'commit, build and switch to the flake'
       complete -c nx -n __fish_use_subcommand -a up -d 'update flake and packages'
       complete -c nx -n __fish_use_subcommand -a clean -d 'garbage-collect the system'
       complete -c nx -n __fish_use_subcommand -a config -d 'open config files in $EDITOR'
       complete -c nx -n __fish_use_subcommand -a push -d 'commit and push changes'
       complete -c nx -n __fish_use_subcommand -a nuke-history -d 'squash all history into one commit and force-push'
       complete -c nx -n __fish_use_subcommand -a doctor -d 'up + clean + push'
       complete -c nx -n __fish_use_subcommand -a '--help' -d 'show help'
     '';
   };
 };Features:A ton of eza aliases
NixOS management commands
A couple more aliasesA brief overview of the NixOS managment commands:Usage: nx <command>

Commands:
 deploy        commit pending changes, then build and switch to the flake
 up            update flake.lock and all packages, then deploy
 clean         garbage-collect the system (nix-collect-garbage -d)
 config        open flake.nix and everything it imports in $EDITOR
 push          commit pending changes and push to the remote
 nuke-history  squash all git history into one "initial commit" and force-push
 doctor        up + clean + pushRegarding nx nuke-history: this command completely removes all commits and creates a single clean commit. I only need this because I just like having a clean git history on my GitHub repository, and I only use git for the convenience of cloning a repository from any device, so I don't need git history.Here is the config itself: programs.fish = {
   enable = true;

   interactiveShellInit = ''
     set -g fish_greeting
   '';

   shellAliases = {
     svim   = "sudo -E vim";
     svi    = "sudo -E vi";
     cat    = "bat -P --theme zenburn";
     "..." = "cd ../..";
     "...." = "cd ../../..";

     # -- eza aliases --

     # basic listings
     ls    = "eza";                        # standard list
     l     = "eza -1";                     # one column
     la    = "eza -1a";                    # one column with hidden files
     ll    = "eza -l";                     # long format
     lla   = "eza -la";                    # long format with hidden files

     # filtered listings
     ld    = "eza -D";                     # directories only
     lld   = "eza -lD";                    # long format, directories only
     lf    = "eza -f";                     # files only
     llf   = "eza -lf";                    # long format, files only

     # sort variants
     lsz   = "eza -l --sort=size";         # sort by size
     lsx   = "eza -l --sort=extension";    # sort by extension
     ltm   = "eza -l --sort=modified";     # sort by modified time
     lcr   = "eza -l --sort=created";      # sort by created time

     # git-aware
     lgit  = "eza -l --git";               # show git status
     lx    = "eza -lbhHigUmuS --git";      # extended info with git

     # tree (default depth 3)
     lt    = "eza --tree --level=3";       # tree, depth 3 by default
     lta   = "eza -a --tree --level=3";    # tree with hidden files, depth 3
     llt   = "eza -l --tree --level=3";    # long tree, depth 3
     llta  = "eza -la --tree --level=3";   # long tree with hidden files, depth 3
   };

   # -- nx: system configuration management --

   functions = {
     __nx_stage = ''
       echo ""
       set_color -o blue
       echo -n "==> "
       set_color normal
       echo "$argv[1]"
     '';

     __nx_diff_dirty = ''
       # -N stages new files by path only (no content), so they show up
       # in the diff below as additions instead of being invisible
       git -C /etc/nixos add -N -A
       git -C /etc/nixos diff
     '';

     __nx_commit_if_dirty = ''
       set -l changes (git -C /etc/nixos status --porcelain)
       if test (count $changes) -gt 0
         __nx_stage "Changes to commit:"
         __nx_diff_dirty
         git -C /etc/nixos add -A
         git -C /etc/nixos commit -m "$argv[1]"
       end
     '';

     __nx_config_files = ''
       # walk the import graph starting at flake.nix, following relative-path
       # nix file references, so new modules are picked up automatically
       set -l root /etc/nixos
       set -l seen $root/flake.nix
       set -l queue $root/flake.nix
       while test (count $queue) -gt 0
         set -l f $queue[1]
         set -e queue[1]
         set -l dir (path dirname $f)
         for rel in (sed -E 's/#.*$//' $f 2>/dev/null | grep -ohE '\.\.?/[A-Za-z0-9_./-]+\.nix')
           set -l full (realpath -m $dir/$rel)
           if not contains $full $seen
             set -a seen $full
             set -a queue $full
           end
         end
       end
       for f in $seen
         echo $f
       end
     '';

     nx = ''
       switch "$argv[1]"
         case deploy
           __nx_stage "Checking for local changes"
           __nx_commit_if_dirty "nx: auto-commit before deploy"
           __nx_stage "Building and switching to the new configuration"
           sudo nixos-rebuild switch --flake /etc/nixos#nixos

         case up
           __nx_stage "Updating flake inputs"
           nix flake update --flake /etc/nixos
           and nx deploy

         case clean
           __nx_stage "Collecting garbage"
           sudo nix-collect-garbage -d

         case config
           __nx_stage "Opening configuration files"
           set -q EDITOR
           or set -l EDITOR vi
           $EDITOR (__nx_config_files)

         case push
           __nx_stage "Checking for local changes"
           __nx_commit_if_dirty "nx: update"
           __nx_stage "Pushing to remote"
           git -C /etc/nixos push

         case nuke-history
           echo "WARNING: this permanently deletes ALL git history in /etc/nixos."
           echo "Every file will be committed fresh as a single \"initial commit\","
           echo "which is then force-pushed, overwriting the remote history too."
           echo "This cannot be undone."
           echo ""
           read -l -P "Continue? [y/N] " confirm
           switch "$confirm"
             case y Y yes Yes YES
               set -l changes (git -C /etc/nixos status --porcelain)
               if test (count $changes) -gt 0
                 __nx_stage "Local changes that will be swept into the new history:"
                 __nx_diff_dirty
               end
               __nx_stage "Squashing history into a single commit"
               set -l branch (git -C /etc/nixos branch --show-current)
               set -l remote (git -C /etc/nixos remote | head -n1)
               git -C /etc/nixos checkout --orphan __nx_nuke_tmp
               and git -C /etc/nixos add -A
               and git -C /etc/nixos commit -m "initial commit"
               and git -C /etc/nixos branch -D $branch
               and git -C /etc/nixos branch -m $branch
               and __nx_stage "Force-pushing rewritten history"
               and git -C /etc/nixos push --force --set-upstream $remote $branch
             case '*'
               echo "Aborted."
           end

         case doctor
           __nx_stage "Running full maintenance cycle (up, clean, push)"
           nx up
           and nx clean
           and nx push

         case '*'
           echo "nx — manage the NixOS configuration in /etc/nixos"
           echo ""
           echo "Usage: nx <command>"
           echo ""
           echo "Commands:"
           echo "  deploy        commit pending changes, then build and switch to the flake"
           echo "  up            update flake.lock and all packages, then deploy"
           echo "  clean         garbage-collect the system (nix-collect-garbage -d)"
           echo "  config        open flake.nix and everything it imports in \$EDITOR"
           echo "  push          commit pending changes and push to the remote"
           echo "  nuke-history  squash all git history into one \"initial commit\" and force-push"
           echo "  doctor        up + clean + push"
       end
     '';
   };

   completions = {
     nx = ''
       complete -c nx -f
       complete -c nx -n __fish_use_subcommand -a deploy -d 'commit, build and switch to the flake'
       complete -c nx -n __fish_use_subcommand -a up -d 'update flake and packages'
       complete -c nx -n __fish_use_subcommand -a clean -d 'garbage-collect the system'
       complete -c nx -n __fish_use_subcommand -a config -d 'open config files in $EDITOR'
       complete -c nx -n __fish_use_subcommand -a push -d 'commit and push changes'
       complete -c nx -n __fish_use_subcommand -a nuke-history -d 'squash all history into one commit and force-push'
       complete -c nx -n __fish_use_subcommand -a doctor -d 'up + clean + push'
       complete -c nx -n __fish_use_subcommand -a '--help' -d 'show help'
     '';
   };
 };

r/fishshell • • Aug 12 '26

Kubernetes completions for labels

2 Upvotes

Does anyone know good fish shell completions with Kubernetes labels support, that work with the already integrated completions for Kubernetes?

I mean if you say

kubectl get pods -l app=myapp

to have autocomplete.

Thanks :D


r/fishshell • • Jul 10 '26

Noob queston about switching default shell to Fish

9 Upvotes

Hi, I'm new to Linux, and my distro is Void Linux (sorry, don't know, whether this is relevant).

I really like all QoL features of Fish shell, but I find variable management very confusing. Will I be missing out on some of the Fish's advantages if I just put it in my terminal config as a shell instead of chsh-ing it?


r/fishshell • • Jul 04 '26

a fish wrapper for the ze.sh directory jumper

9 Upvotes

ze.sh is a minimalist shell-native frecency-based directory jumper in the z.sh lineage, with an exponential moving sum scoring model on an event clock rather than wall-clock time. Repo: github.com/jghub/ze. Previously bash/zsh/ksh/mksh only. A fish wrapper is now available in contrib/fish/. It mirrors the full option set including fzf interactive selection (ze -f), and tracks directory changes via a dedicated _ze_cd function that backgrounds the database update so there is no perceptible latency overhead. Installation is three file copies and a chmod — no compiled binary, no external runtime dependency beyond bash (ksh works too and is faster, if you have it). I don't actively use fish myself — let me know if the wrapper is useful.


r/fishshell • • Jun 26 '26

Fish shell is slow when I click enter

7 Upvotes

for some reason when i click enter fish shell is slower(it's not smooth) than bash, I use tmux + foot + starship + fish/bash

any help! thank you...


r/fishshell • • Jun 24 '26

How to make Fish shell's help command open in a terminal pager (like less) instead of a browser?

2 Upvotes

I want the native help command in Fish shell to display its documentation directly inside my terminal using a pager like less (or a text-based alternative), instead of opening a graphical web browser.


r/fishshell • • Jun 18 '26

Who says fzf-tab in other shells is the best? My fzf-tab looks better in fish

Thumbnail
gist.github.com
13 Upvotes

hehehe (simple, no bullshit, fast as hell, and no plugins required)

if you want to install it using fisher:

fisher install developic/fzf-tab


r/fishshell • • Jun 16 '26

fzf-tab (simple, no bullshit, fast as hell, and no plugins required)

Thumbnail
gist.github.com
13 Upvotes

r/fishshell • • Jun 04 '26

[SUPPORT] fish_config web app themes don't work?

3 Upvotes

The prompt section works fine but when i try to change a theme it stays the default one.Any suggestions would be very appreciated.


r/fishshell • • May 25 '26

Fish Einrichten

Post image
0 Upvotes

Wie ändere ich meine Fish Commandozeile?


r/fishshell • • May 22 '26

I've created a plugin to sync shell history between machines

Thumbnail
github.com
9 Upvotes

Hello everyone I've created a plugin to sync history over various backends, SFTP, S3 and private git repo.

I'm using this on all my machines and thought I would share it here in case someone else has been looking for something similar.

I tried Atuin but I didn't like how much it changed the behavior of my shell


r/fishshell • • May 21 '26

devenv 2.1: Nix with zsh, fish, and nushell via libghostty

Thumbnail
devenv.sh
16 Upvotes

r/fishshell • • May 19 '26

Made a shell greeter that generates a unique rocket every time you open a terminal tab

Post image
29 Upvotes

every new tab rolls a random rocket. save the ones you like and they'll come back. ~2×10⁴³ combinations, all deterministic from the hex palette.

rn it works on bash, zsh, powershell, and fish

https://github.com/clefspear/starcommand

lmk what you think!


r/fishshell • • May 17 '26

kube-ps1 updated with a working fish port

Thumbnail reddit.com
2 Upvotes

r/fishshell • • May 16 '26

How to sudo !! in fish ?

12 Upvotes

If I make a command and I want to do it again with sudo, or anything before or after, in bash you can just append it wit !!. Whats the equivalent with fish ?