Questions tagged [fish]

The fish shell is an alternate shell, and scripting language, for *nix systems (including macOS). Its claim to fame is being an intuitive, user friendly, and efficient modern shell. Some key examples, per their own website, are enhanced syntax highlighting, completions and autosuggestions (automatically generated from man pages), high performance, and sane scripting.

fish
Filter by
Sorted by
Tagged with
0 votes
0 answers
243 views

Fish shell how to export current directory like in bashrc file

So I've changed to fish and I can't seem to export a variable like in bash let me show you: In my ~/.bashrc file I have this: export AIRFLOW_HOME="$(pwd)/airflow" So when I launch airflow ...
1 vote
1 answer
392 views

Remove preset binding in fish shell

I am unable to remove the default binding in Fish shell for CTRL + p. I want to activate separate "background" app outside of the terminal using the CTRL+P shortcut. I have tried: bind --...
1 vote
1 answer
497 views

Command not found when running as other user with sudo

I am trying to run psql with user postgres. When I run sudo su - postgres AND THEN psql from within the new session, it is working smoothly. In fact, the ~/.bashrc in that session with use postgres ...
1 vote
1 answer
74 views

Fish shell wildcard returns different output

I'm trying to create a fish function with named argument contains a wildcard *. But the output between the function I made and the plain command are different. Here's my function: function ls-wildcard ...
-2 votes
1 answer
178 views

Why does my android studio Terminal not recognize flutter? [duplicate]

I open my terminal on MacOS where everything works. I run which fish, and I set the Shell path in Android Stuido to the output: /opt/homebrew/bin/fish If I then run which flutter in there, it doesn't ...
1 vote
2 answers
2k views

Can I use Bash autocompletions for kubectl in fish?

Does anybody use fish shell with Kubectl commands? This Bash completion source <(kubectl completion bash | sed 's/kubectl/k/g') works like dizzying charm for Bash. But how to do that same thing in ...
1 vote
1 answer
89 views

How to rebind space to enter in fish shell when in normal mode (vi bindings)

I want to be able to run the current command (as I would by hitting enter) bu hitting space while in normal mode, and while running the vi keybindings, in the fish shell.
0 votes
1 answer
378 views

How to do a package in git-bash (msys2) in windows?

In linux when I use fish shell there is a feature called abbreviation where I can make a list of abbreviation to use when I type in the terminal is autocompleted. For example: Context: I have a list ...
1 vote
1 answer
115 views

fish shell functions not accessing user paths

I've recently started using fish, and I needed to use a jar file for google's bundletool. As such, I needed to set up an alias/function for bundletool, and I chose a function since it seems more "...
0 votes
1 answer
88 views

Check the argument in Fish script?

#!/usr/bin/fish if count $argv > /dev/null or not test -d $argv[1] echo 'Expected a directory.' exit 1 end I want to check if the argument is a directory and have searched and edited the ...
3 votes
3 answers
5k views

strange characters when pasting into terminal/fish shell: [200~ and [201~

When I paste something into ranger with Ctrl+Shift+V I get strange characters. Here I pasted word "paste" into ranger: And on the begining I have [200~ and at the end [201~. I have no idea what could ...
7 votes
4 answers
1k views

How to capitalize string in fish shell?

I got the following text: Lorem ipsum dolor sit amet, consectetur adipisicing elit. That I want to capitalize, i.e. uppercase first letter of every word. Expected result Lorem Ipsum Dolor Sit ...
1 vote
1 answer
55 views

How to use completions when prefixing a command with bundle exec?

When I try to run a command like cap with bundle exec cap my completions for cap tasks do not work. Instead I get a directory listing: > bundle exec cap -T app/ config.ru Gemfile.lock ...
1 vote
1 answer
775 views

How do I set standard Interpreter path for python in vscode config json?

I use fish shell and I just want to when I open the vscode it automatically selects the virtual environment that was activated in virtual fish. I want to have something like this: "python....
0 votes
1 answer
133 views

How to iterate over a series of directories, running a program and redirecting its output to the input file instead of stdout? (fish)

Essentially, I want to run a program which takes FILE as input over a directory, recursing into each directory and running the program on each file. However, this program outputs a modified version of ...
59 votes
3 answers
26k views

fish shell. How to check if a variable is set/empty?

How can I do something like set variable (some_command_that_may_return_a_string) if [ variable is set ] do_something and inversely how do I check if the variable is empty?
11 votes
3 answers
5k views

How to prevent Fish shell from closing when typing Ctrl-D (EOF)

I am using fish shell. When I type Ctrl-D, it sends a EOF to my terminal and then terminal closes. I want to make it such that ctrl-D does not close my iterm2. I saw that people have set up ...
9 votes
5 answers
13k views

Glob matching (wildcards) in fish shell not matching bash behavior

When I the following command in bash, I get a list of files that match the regular expression I want: $> ls *-[0-9].jtl benchmark-1422478133-1.jtl benchmark-1422502883-4.jtl benchmark-1422915207-...
0 votes
1 answer
110 views

Customize default "git branch" output format and sorting?

I'd like to be able to write git branch and the output (when no other params are passed) would follow my pre-defined sorting and formatting specifications. But is that possible? Now, I know the --sort ...
0 votes
0 answers
202 views

Fish: Create an alias for "pipe grep"

I would like to create an alias for | grep eg, for example be able to write: ps -axf G chrome instead of ps -axf | grep chrome This question was already asked on stackoverflow, however in the context ...
0 votes
1 answer
223 views

How can I add arguments to a piped script in fish shell?

I am looking for a way to add arguments to a piped curl script which shall be executed in a fish shell. In my case, this is installation of oh-my-fish via curl. The command without arguments is: curl ...
0 votes
1 answer
135 views

How to use lmod with fish?

While lmod support fish from version 7.4 onwards, I have to use servers with an older version. How can I make it work with fish? (Even if in limited capacity.)
5 votes
2 answers
3k views

GOPATH environment variable not getting set in the Fish shell?

I have a ~/.config/fish/config.fish which contains the following lines: set PATH $PATH (go env GOPATH)/bin set -x GOPATH (go env GOPATH) If I simply run go env GOPATH at the command line, I get the ...
16 votes
2 answers
2k views

Is there a linter for fish like there is for bash with shellcheck?

For sh/bash/zsh there is https://github.com/koalaman/shellcheck however there won't be support for fish with it https://github.com/koalaman/shellcheck/issues/209 - is there any linters for fish?
36 votes
4 answers
42k views

Fish Shell: How can I customize the colors for the autocomplete feature?

I started using Fish (and oh-my-fish) a couple of weeks ago and one of the things that I find somewhat visually hard is the default background color of the autocomplete options (see the purple ...
1 vote
1 answer
192 views

if statement in fish_prompt

I'm trying to customize my fish prompt but i can't seem to put an if statement in it. What I want : user@host ~/.config [127]> What i tried : function fish_prompt echo -n $USER echo -n &...
14 votes
4 answers
4k views

How do I install Fish Shell on AWS Linux [closed]

I can't seem to install Fish shell on an AWS Linux instance. I keep getting the following error and can't seem to find a fix for it. [root@ip-172-31-20-125 ec2-user]# yum -y install fish Loaded ...
19 votes
4 answers
6k views

Can a Fish script tell what directory it's stored in?

So, I really like Fish - but I need some help with scripting. and in particular finding the path of the script being run. Here is the solution for BASH Getting the source directory of a Bash script ...
24 votes
7 answers
29k views

Add conda to path in fish

~> conda install pandas fish: Unknown command 'conda' I understand that I need to add conda to PATH, but no matter what combinations of commands I tried, I could get it to work. I still get the ...
2 votes
3 answers
6k views

tmux won't start if default shell is fish

I have tmux and fish both installed via apt on an Ubuntu 19.04 (Disco Dingo). tmux works well out of the box but it uses bash and I would like it to use fish as default shell. Thus I put the ...
4 votes
1 answer
2k views

How to remove blank line before prompt when I set fish_greating to null?

I want to remove the blank line before prompt when I open a new fish shell window. I try to remove fish_greating use official FAQ. ➜ set fish_greeting Here's my plugins. vue-multiple-pages on  ...
0 votes
1 answer
322 views

Batch Rename in Fish shell

I get 15 or 20 files every week with random names that include several symbols such as !,' etc. Plus there is space. So I need to replace space with _, and any other symbols to nothing before I can ...
-1 votes
1 answer
323 views

Change LSCOLORS using fish on macOS

I'm trying to set the colour of dirs in Terminal on the latest version of macOS (12.5) with an M1 using fish. I've tried both the suggested commands: set LSCOLORS XXXX and set -Ux LSCOLORS XXXX with ...
149 votes
4 answers
139k views

How to set environment variables in fish shell

Can someone please tell me what's the correct way to set a bunch of environment variables in the fish shell? In my ~/.config/fish/config.fish file, I have a function to setup my environment variables ...
1 vote
1 answer
1k views

How to set default text editor in ranger? My shell is fish

When I'm trying open some text document using ranger and having this error: /bin/sh: line 1: vim: command not found I have this strokes in config.fish: set EDITOR "nvim" set VISUAL "...
2 votes
2 answers
777 views

Set DISPLAY variable constantly in fish

Following Situation I need to setup the DISPLAY Variable for my WSL2 to transmit goutput to the Xserver running on my Host-System. In general I would do this by using my .bashrc: export DISPLAY=$(ip ...
2 votes
1 answer
736 views

Setting $ANDROID_SDK_ROOT on fish shell from bash shell equivalence

I'm trying to set $ANDROID_SDK_ROOT for fish shell in config.fish, I previously had the configuration set on my previous linux installation which used bash as follows: export ANDROID_SDK_ROOT=$HOME/...
1 vote
2 answers
588 views

Having an interactive menu when running a shell command

I have this line in my .tmux.conf file. bind-key q run "fish --interactive -c q" The code for function q is written in fish. This is the code. function q set session (t ls | fzf) ...
1 vote
3 answers
171 views

How can I compose a list of option flags and pass them to a command in Fish Shell?

Since Docker Compose supports multiple Compose files, I want to detect all such files in the current directory and pass them to Docker Compose instead of needing to specify all of them manually. In ...
0 votes
1 answer
322 views

omf/git plugin colors customization

I have omf, git plugins + agnoster theme installed. When I do git status, the files "not staged for commit" are listed in bright red color. So much so that I can barely read them, given my ...
0 votes
2 answers
975 views

passing whole strings as arguments in fish shell

I have a number of cases where I need to pass free-form (i.e. containing white space and symbols as well as alphabetical symbols) strings as parameters to a function in fish shell. Here's an example ...
1 vote
2 answers
693 views

How to show commands being executed in fish shell function

I have a function in fish shell that calls a bunch of commands sequentially. How do I add the commands that are being executed to the output? Essentially if I had a bash script doing that I would ...
16 votes
1 answer
2k views

How do I redirect a string in Fish?

I want to redirect a string into the STDIN of a command. I would do it using something like cmd <<< "my string" in Bash, or even cmd <<EOF ... EOF. But I can't seem to do either in ...
1 vote
2 answers
3k views

Fish shell custom function for output text coloring

When using fish shell in a terminal-emulator (such as terminator) together with a command that outputs lots of text it could be useful to get some color coding on the output. I know that a script can ...
0 votes
1 answer
474 views

I have to reload shell (exec $SHELL -l) to load all PATHs on Fish shell

I set Fish as a login shell referenced here(https://fishshell.com/docs/current/index.html#default-shell). Then installed rbenv. But I have to reload Fish shell to call rbenv. Easy to understand to ...
0 votes
2 answers
853 views

How to set background default color in fish shell?

Specifically, I want to set the default background color to "Solarized Dark" in my fish shell for Iterm2. Currently, I have to manually change the background every time I start my fish shell ...
1 vote
1 answer
960 views

Problem modifying PATH variable in fish config

I have the following configuration in ~/.config/fish/conf.d/python.fish: # Initialise pyenv if found echo "Running python config" if status --is-interactive && test -d "$HOME/....
1 vote
1 answer
371 views

fish executing file with relative path

I'm having an issue where I can't run fish x.fish or fish ./x.fish, but I can run fish (pwd)/x.fish, AKA using an absolute path to my file instead of a relative one or with .. I haven't had this issue ...
3 votes
1 answer
144 views

Creating an alias for `git commit` accepting N arbitrary `-m` arguments

Using the Fish shell, I would like to create a function (gcom) to use as an alias for the git commit command, accepting an arbitrary number of string arguments and passing them as -m options, so that ...
236 votes
10 answers
150k views

Suppress or Customize Intro Message in Fish Shell

Is it possible to remove the intro message in fish shell: Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish

1 2 3
4
5
21