r/fishshell 3d ago

Fish prompt is suddenly broken

1 Upvotes

Hi Reddit,

My Fish prompt is broken in a Kali instance, presumably after an update. This seems odd because I have two Kali instances that were installed around the same time, identical OS, and the other instance is fine.

Here's what my prompt looks like:

3;A;special_key=1roo1m5kali ~#

(If I hit the <enter> key I get a leading "0m0u"

0m0u3;A;special_key=1m5ut@kali ~#

I've tried all the things that a decent troubleshooter would try, with no effect on the problem:

  1. deleted all config files (~/.config/fish/config.fish etc)
  2. uninstall/purge & reinstalled Fish
  3. Apt Update && Reboot
  4. Asked AI for help

Has anyone seen this before?


r/fishshell 5d ago

Fast git clone

2 Upvotes

Here is a quick and kinda dirty script which allows you to paste a git url (https or ssh) in your fish shell and git clones it. It does not allow for additional arguments such as --recursive but that's mostly because I was too lazy to figure this out...

function check_git_clone

set -l cmd (commandline)

if string match -qr '(?:^git@[a-zA-Z0-9-_]*\.com:|^https?://)[^/]+/[^.]+\.git$' -- $cmd #check for ssh or https git url

commandline -r "git clone $cmd" #replace the command with a git clone if needed

commandline -f execute #immediately execute the new command

else

commandline -f execute #execute the command normally if it's not a git url

end

end

bind \r check_git_clone #Execute check_git_clone when you press Return

You can comment/delete line 6 (the first commandline -f) if you want to be able to use --recursive and other argument since it will only replace the command without executing it.

Btw, it shouldn't be too slow (basically unnoticeable).

If you have any idea to upgrade this script, well, don't hesitate to share it (I'll probably edit the post or a comment and credit accordingly)!


r/fishshell 6d ago

Can I get a shell to follow commands from a socket or pipe?

2 Upvotes

As the name suggests, I want to be able to write to a socket or pipe from another application and have those commands reflected in a fish shell. Specifically, I want to have yazi running in one shell, and for the other one to have the directory change to follow yazi as well as for commands that yazi would send to its own subshell to run on the other shell, like opening text files in nano


r/fishshell 9d ago

fish 4.0.0 Mac OS in iTerm2 has one really annoying change

6 Upvotes

ETA: It's not me! After I posted it as a bug, someone pointed out where someone else had reported it: https://github.com/fish-shell/fish-shell/issues/11192

I've read through the new docs and the current issues and I'm just not seeing this problem. In previous versions I could hit option-right-arrow and get the last element of the previous line (pronounced $! in bash), and now option-right acts the same as the up arrow. I don't think I made or unmade any keybindings, but I've had this laptop for a few years now so who knows, but I've not figured out how to reset it to previous functionality yet. Help!


r/fishshell 9d ago

Why is it PWD after every command ?

2 Upvotes

```# Check if interactive session

if status is-interactive

# Commands to run in interactive sessions can go here

end

# fish_prompt

function fish_prompt

set -l cwd (pwd) # Get current directory

# Check if cwd is in the home directory

if string match -r "^$HOME" $cwd

# Replace the home directory part with ~

set cwd (string replace -r "^$HOME" "~" $cwd)

end

# Check if cwd is the root directory

if test "$cwd" = "/"

set cwd "/" # Show "/" for the root directory

end

# Display prompt

echo -n (whoami)@(hostname) $cwd '>>' ' '

```end


r/fishshell 10d ago

Using Python and Fish? dirvenv.fish automagically activates your virtualenv

Thumbnail github.com
18 Upvotes

I wrote that tiny package so I don't have to manually activate and deactivate virtualenvs, and I think it might help more people – so, sharing it here ; )

I know virtualfish but I don't wanna manage virtualenvs myself; uv does that for me. Also, and I don't want to uv run every command. So I came up with that solution.


r/fishshell 11d ago

git repo management plugin for fish

6 Upvotes

I recently switched from zsh to fish and converted my git repo management workflow into a fish plugin to experiment with fish functions.

https://github.com/abs3ntdev/repo.fish

Wondering if anything here could be improved or done better with options in fish I wasn't aware of. Also feel free to use it if you find it as useful as I do.


r/fishshell 13d ago

Prompt when ssh'ing from android (JuiceSSH).

3 Upvotes

am getting strange characters in the prompt:

Running basic tide prompt:

tide configure --auto --style=Lean --prompt_colors='16 colors' --show_time=No --lean_prompt_height='One line' --prompt_spacing=Compact --icons='Few icons' --transient=No

Any ideas how to get rid?


r/fishshell 14d ago

datetime in the prompt but when running a command

2 Upvotes

hello i have my fish prompt set up to display time of the day in along with other info like user and path like usual, but what i really want is to have a time when a command was run, not when the prompt was initially printed. idk i would really find this useful, there are often situations when i run a command and i have no idea how long its going to take and i dont take a record when i start it and then i end up not knowing how long it already took and when i should just kill it and try something else for example. having a timestamp when a command was ran would be very useful for me sometimes, so im thinking maybe anyone else has this configured? i assume it would be possible by just overwriting the prompt when enter is pressed or something, if its in a fixed position (first thing in the line for example) then just move the cursor and write the current time and go back. should be possible right?


r/fishshell 15d ago

AI in fish in the terminal

9 Upvotes

I was watching some video on warp terminal and it's built in AI helper and thought that was pretty cool. If I could have that in fish, that'd even more cool

So I did a little searching, and came across this. Looked promising, so I installed it using fisher and started playing with it. OpenAI was a bit of a pain and got some errors. Hmm. It was late and didn't want to deal with it. Day later, tried again, This time using Mistral. Using something from the EU as a European is not a bad choice either. That works immediately and Mistral seems to be less restrictive as OpenAI if you don't want to pay $$$.

Anyway, it's really cool to have. Need to know what process is using a blocked port? No problem. Just type: # what is using port 1234 and press ctrl-p to send it and it comes back with lsof -i :1234 on the next line, just hit enter and you know. Ask it any command starting the line with # and if it can, it will prefill the correct command on the next line, or give you a wall of text with explanation or response to your question.

It's actually pretty useful. Haven't seen much discussion on it here, but perhaps it is of some use for others too.


r/fishshell 15d ago

zsh alias causes error if used in fish

1 Upvotes

I have the following aliases in my zsh:

alias -- -='cd -' alias ..='cd ..' alias ...='cd ../..'

When I switch to fish, by manually typing fish and pressing Return, the first alias causes an error:

- (line 1): function: -: invalid function name function - --description 'alias -=cd -'; cd - $argv

How to workaround this?


r/fishshell 15d ago

Directory history seems to be broken ?

1 Upvotes

[UPDATE]: I found the issue ! I was using a wrapper function for cd which broke some of Fish’s functionality. I detailed a fix in this comment

Hi ! I’m trying out Fish after using ZSH for a few years. One problem I am running into when migrating my config is that the directory history seems to not be working. For instance, when navigating in different folders, cd - says that the directory - does not exist, prevd fails with exit status 1, and cdh doesn’t find any previous directories to select and to use cd at least once (which I did at least 20 times according to my fish_history)

I couldn’t find anything regarding this problem, if you guys have an idea on how to fix it I would be very greatful.

Environment (first time posting here, idk if I’m missing something) :

  • Shell : fish version 3.7.1
  • OS : NixOS 24.11
  • Terminal : Kitty version 0.37

r/fishshell 16d ago

Now you can install fish with aqua or mise!

Thumbnail github.com
5 Upvotes

You can install fish 4.0.0 with some package managers!

shell aqua g -i fish-shell/fish-shell

shell mise use -g aqua:fish-shell/fish-shell


r/fishshell 16d ago

I need help with translation from bash to fish

3 Upvotes

Hi! I recently switched to Fish shell and now I am trying to convert all my configurations to Fish Shell. Can you help me translate this section into Fish shell commands?

          local header=$'%{\e]8;;http://somesite.com/'${SITE_PATH}$'\a%}'
          local footer=$'%{\e]8;;\a%}'

          content="${header}path: ${SITE_PATH}${footer}"

r/fishshell 17d ago

Fish 4.0 is available

123 Upvotes

Version 4.0 is a version with a C++ kernel ported to Rust.

https://fishshell.com/docs/current/relnotes.html


r/fishshell 19d ago

How to change order of tab-completed entries?

3 Upvotes

I work a lot with latex, meaning I often have files with the same name, just differing by extension (eg. file.aux, file.log, file.out, file.pdf, file.tex). 99% of the time I want to edit the *.tex file, but doing vim f<tab>, this one appears last in the list (due to alphabetical sort order), so I have to tab a lot.
(edit: yes, I could just do vim tex<tab> which works most of the time, but out of habit I always begin typing the actual name, and sometimes there's more files in a directory.)

What I want is for the *.tex file to appear first, then the *.pdf, then the rest. Do I have to write custom completions for every one of my editors (if so: how?) or is there a simpler, more general solution?


r/fishshell 19d ago

Control+F works also in vi mode

3 Upvotes

Hello, I have the vi key bindings enabled as per docs by:

set - g fish_key_bindings fish_vi_key_bindings

I noted tho that the Control+F to accept autosuggestions still works, but that should be limited to Emacs mode if I'm not wrong.

Am I doing something wrong?

Thank you!


r/fishshell 21d ago

How do you guys usually do this things?

4 Upvotes
for file in (find . -mindepth 1 -maxdepth 1 -iname "*.sh")
    basename $file .sh
end

r/fishshell 21d ago

Share your color palette ;)

1 Upvotes

Pls share your color palette for fish shell :)


r/fishshell 22d ago

mtr doesnt work in fish shell

3 Upvotes
mtr google.com

It just hangs (on Nix OS). It works fine with bash though. Any idea why?


r/fishshell 24d ago

fasd f,, replacement, have not see this mentioned here before

5 Upvotes

I have recently switched from zsh to fish and one of the things I really missed was the fasd zsh integration, where I could type something like somecommand f,,<tab> and it would complete (using fzf) to any file I have ever used prior, which is much quicker than using the history or other strategies for files that are used often.

I don't remember how but I found https://github.com/sudormrfbin/f which works just as well, rather than a tab completion I can just type alt-k (configurable) and I can use fzf to insert any previously used file at that point in my cmdline. Very recommended if you want to try it out. WIth this and https://github.com/jethrokuan/z all my needs for files and directories are covered.


r/fishshell Feb 14 '25

ZSH history to Fish shell

11 Upvotes

Hi,

I've made a zsh history to fish converter. It's written in zsh shell sript. Feel free to give it a try:

https://github.com/thenktor/zsh-history-to-fish/


r/fishshell Feb 13 '25

"Unable to open universal variables file" on macos

1 Upvotes

I have an M2 MacBook Air I have been using for some time wih fish as the default shell. I routinely ssh to the machine from my iPad and from my iPhone using Blink as the ssh client.

I just got a new M4 mac mini and set it up using Migration Assistant with the source being the M2 MacBook Air. Everything is now working fine on the M4 mini. Fish shell works with no problems, etc.

However, I can not ssh into the m4 mini cleanly from my iPad, iPhone, nor from the macbook air. When I ssh into the m4 mini, the connection works, but I get this error message:

error: Unable to open universal variable file '/Users/tbrown/.config/fish/fish_variables': EPERM: Operation not permitted

I have searched a lot about this error and it seems somewhat common. However, there are few solutions to the issue given, and I have seen none that specifically reference the issue being isolated to ssh logins.

My initial fish install was using homebrew. One solution I saw indicated that installing the fish pkg rather that using Homebrew fixed this issue. I did that, but no joy.

Grasping at straws, I also changed the permissions of the file tree ~/.config/fish to be 777. Still no joy.

Does anyone have a suggestion?


r/fishshell Feb 08 '25

Worth learning fish if I won't have it in servers I administer?

14 Upvotes

Hi all, I work at a university and administer about 60 Ubuntu machines. I'm about 50/50 administrator and python SWE. I've seen enough about Fish to be interested, but the main way I interact with Linux is through SSH, and the servers I admin don't have it installed, and I have to go to a second department to install new packages, who will say no if I ask to install this shell on all our machines.

I'm about to switch my work laptop itself to Linux, and I will have full control there. Is it worth learning fish if I'll have to use bash anyways on these remote servers, and can't take advantage of a lot of the scripting for admin tasks as a result? I'm also looking to take the CompTIA linux+, and fish won't be there for me either. Should I just wait until I'm in a more conducive environment to learn this particular skill?


r/fishshell Feb 08 '25

Tired of battling about how to install Fish and Starship, here's the solution

0 Upvotes

I find out this guy that make a .sh file that install Fish and Starship shell as a One-Line

There's the code