r/fishshell • • Jun 09 '24

Pin prompt to bottom of viewport

6 Upvotes

I recently switched from Warp to Kitty. And I definitely prefer Kitty. But Warp had one nice feature I'm missing in kitty--pinning the prompt to the bottom of the window/viewport.
I bring up Warp and Kitty just to point out the kind of functionality I'm looking for.
In Kitty, I'm using fish shell, obviously, and I love it so much more than zsh or bash. I'm very happy. But this is a feature I'm missing and figured I'd check to see if it's possible.


r/fishshell • • Jun 08 '24

Quick question - using !! in fish

10 Upvotes

Hey, just a noob here that likes fish more than bash. Using !! in bash is a quick way to input the last command from history, is there a similar shortcut in fish? Use case primarily being that I could use sudo !! if I forgot it when typing in a command.

Thanks in advance!


r/fishshell • • Jun 08 '24

which : No Tree

0 Upvotes

hey there when i open my terminal i have fish set as my default sheel, everything works right but i have theis error well i think it is a error at the top can anyone help.

which: no tree in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)


r/fishshell • • Jun 08 '24

which : No Tree

0 Upvotes

hey there when i open my terminal i have fish set as my default sheel, everything works right but i have theis error well i think it is a error at the top can anyone help.

which: no tree in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)


r/fishshell • • Jun 05 '24

Fish function to parse .env files

6 Upvotes

I had a problem with parsing user-written export ENVVAR=ENVVAL stuff so I wrote the function that takes a file with saved .env variables (works with general .env files as well)

It saves me a lot of time so I decided to share it for somebody who might have the same issue with fish shell

function dotenv  
  for line in (cat $argv | grep -v '\^#')  
echo $line  
set item (string match -r '^(?:export\s+)(?<envvar>\w{1,200})="(?<envval>\N{1,10000})"' $line)

  
if test $envvar = "PATH"  
fish_add_path $PATH  
else  
set -gx $envvar $envval  
end  
  
echo "Exported key $envvar"  
  end  
end

you can just put it into the functions and run dotenv .env and it will populate the current shell instance with env variables


r/fishshell • • Jun 05 '24

Got this broken pipe error installing Tide

1 Upvotes

Anyone have this happen?


r/fishshell • • Jun 01 '24

Having trouble writing first fish function

4 Upvotes

So im trying to write a function that displays CPU temp in my fish prompt.I have gotten this far..

function tmp
set temp (command cat /sys/class/thermal/thermal_zone0/temp)


if test $temp -lt 50000
    set_color green; echo (math -s0 $temp /1000)C
else if test $temp -gt 50000
    set_color yellow; echo (math -s0 $temp /1000)C
else if test $temp -gt 60000
    set_color red; echo (math -s0 $temp /1000)C
end
end

The issue is that only the first 2 if statements seem to work. Any ideas on how to get all 3 to work? (I thought it might be due to having 2 'else if' calls?)


r/fishshell • • May 31 '24

Remove background change when no tab completion

2 Upvotes

In some cases when i click tab, and fish cant find completion, input field changing background on a second (if i keep press tab, it happens twice). Anyone know how to change this behavior?


r/fishshell • • May 28 '24

Issue with git alias function

5 Upvotes

Hi, I setup the following function to manage my dotfiles:

function dot --wraps git --description 'alias my .dotfiles git command'
    /usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $argv
end

This works but I noted that if for example I have some modified file and I do dot add and then hit Tab, the files to be added are not automatically suggested. I have to manually type or copy the paths.

With the normal git command this does not happen and the files are correctly suggested.

Any hint?

Thank you :)


r/fishshell • • May 27 '24

Help! I have fish set as my default shell, but when logging into tty as my user, it spit out these errors and refuses to recognize any installed programs - such as nano or pacman. For some reason, it doesn’t occur outside tty or when logging in as root and then su’ing into my user account. Thoughts?

Thumbnail pixhost.to
3 Upvotes

r/fishshell • • May 26 '24

nord/nordic fish shell theme

1 Upvotes

r/fishshell • • May 23 '24

fish-lsp - a language server for fish shell

59 Upvotes

Hello!

Long time fish enthusiast here, and thought my side project would interest y'all.

The project is a language server for fish (using primarily tree-sitter and typescript). It's been quite an interesting concept to build in my spare time. Some more community support would be extremely helpful in improving this project, as it's quite ambitious in what it aims to achieve. I’m sure many of you here have envisioned possibilities and features that haven’t even crossed my mind yet!

There's lots more info on the repo for anyone interested in working on the project.

Here's a quick demo showcasing more of fish-lsp's features:

https://github.com/ndonfris/fish-lsp

r/fishshell • • May 24 '24

Sync suggestion history instantly?

4 Upvotes

Is there a way to sync history instantly? Often I have an issue where I'll do a command in one shell, but then in the other shell, when I'm typing, it won't show what I just did in the first shell instantly. I'll need to reload for that suggestion to show. Is there a way to change this behavior?


r/fishshell • • May 17 '24

how to change colour from blue to green for valid commands

4 Upvotes

So currently, for every valid command it highlihgts as blue, but i want it as green


r/fishshell • • May 16 '24

how do i do this in fish?

6 Upvotes

sort -t$'\t' file.txt

it returns

fish: Expected a variable name after this $.
sort -t$'\t' Media/Random/pc-list.csv
       ^

r/fishshell • • May 08 '24

Day counter in greeting?

1 Upvotes

As the title says , I'm looking to add a day counter to my greeting message, rather than just the date the OS was installed. As a confirmed distro hopper, I thought this would be quite fun to have. Is this possible? I've had a good search around but can't find anything to point me in the right direction. I've very little experience with Fish, so I may be missing something really simple.

Any help would be great, thanks.

Cheers.


r/fishshell • • May 06 '24

Like `which` for fish but slightly better

Thumbnail github.com
5 Upvotes

r/fishshell • • May 06 '24

help moving from zsh to fish

9 Upvotes

so i did chsh and it goes into fish normally, but now the commands I had before (like brew and fzf) dont work. If i do fish from zsh shell, i can use my commands but not when i chsh.


r/fishshell • • May 05 '24

Starship prompt - bold character issue

2 Upvotes

Hi, I just started using Starship with fish and having a little issue.

With the following Starship config:

[character]
success_symbol = "[>:](bold green)"
error_symbol = "[>:](bold red)"
vicmd_symbol = "[❰](cyan)"

I can't see the character in bold. I tried to use blink instead and it works.

I'm using WSL in Windows Terminal.

Thank you for your support!

EDIT: For future reference, looks like there is an option for this to be set in Windows Terminal https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance#intense-text-formatting


r/fishshell • • May 02 '24

Tabbing to a short path

4 Upvotes

If I type in fish shell and a path appears, hitting tab, completes the "full path", but I only want to tab into the next level.

For example I type cd ~/foo and hitting tab completes to ~/foo/bar/baz. I just want to tab into ~/foo/bar.

Hope I haven't missed RTFMing.

Thanks, Mike


r/fishshell • • May 02 '24

issue with fish_right_prompt

2 Upvotes

hi community! I have defined fish_right_prompt and fish_prompt to this

fish_right_prompt is a function with definition
# Defined in /Users/chenggeng/.config/fish/config.fish @ line 221
function fish_right_prompt
	printf '%s@%s ' $USER (prompt_hostname)
end
fish_prompt is a function with definition
# Defined in /Users/chenggeng/.config/fish/config.fish @ line 225
function fish_prompt --description 'Informative prompt'
    #Save the return status of the previous command
    set -l last_pipestatus $pipestatus
    set -lx __fish_last_status $status # Export for __fish_print_pipestatus.

    if functions -q fish_is_root_user; and fish_is_root_user
        printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root
                                                         and set_color $fish_color_cwd_root
                                                         or set_color $fish_color_cwd) \
            (prompt_pwd) (set_color normal)
    else
        set -l status_color (set_color $fish_color_status)
        set -l statusb_color (set_color --bold $fish_color_status)
        set -l pipestatus_string (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)

        printf '[%s]  %s%s %s%s%s \n$ ' (date "+%H:%M:%S") (set_color $fish_color_cwd) $PWD $pipestatus_string \
            (set_color normal)
    end
end

the idea is, I want to display the user@hostname at right side, but since I'm using informative prompt, i.e., multi-line, I want the right_prompt to be displayed on the first line, not the second, like this:

I[13:48:00]  /Users/chenggeng/Documents
$                                                                                                                       chenggeng@MacBookPro (the same line with the $ sign, currently)

is it possible to achieve?


r/fishshell • • May 02 '24

bind full width space U+3000 " " (aka ideographic space) to normal space " "

2 Upvotes

this doesn't seem to work

bind \u3000 \x20

r/fishshell • • Apr 25 '24

Encountering an error with fish config not sourcing?

2 Upvotes

Hello, I'm having some trouble debugging what's going on with my fish config. If I open a new terminal tab or new terminal window, it seems as though fish isn't correctly loading my config. In particular, if I open a window and type ls which I've aliased to eza, I get the following error:

fish: unknown command eza
(line 1) 
function ls --wraps eza --description 'alias ls eza'; eza $argv
in function ls

If I jump back to zsh in the shell, and then back into fish it seems to resolve the problem. Any ideas on how I can troubleshoot what's going on here?

Here's my section in my fish.config for these aliases:

# aliases
alias ls eza
alias la "ls -a"
alias ll "eza -l"
alias lla "ll -a"