Questions tagged [fish]
Fish is a unix shell with a clean design and a limited but powerful feature set.
232
questions
1
vote
1
answer
24
views
Completion for gradle not applying
I'm trying to understand why the gradle completion isn't applying.
Since gw seems to be a keyword for the completion, I created an alias:
alias gw='./gradlew'
(My project uses gradle wrapper. I don'...
271
votes
13
answers
319k
views
Execute a command once per line of piped input?
I want to run a java command once for every match of ls | grep pattern -. In this case, I think I could do find pattern -exec java MyProg '{}' \; but I'm curious about the general case - is there an ...
11
votes
5
answers
10k
views
fish: sudo: !!: command not found
I have fish installed in my Linux Mint DE. I really like how fish makes things easier and it looks so pretty although I haven't find a correct answer about why I can't execute:
sudo: !!: command not ...
0
votes
1
answer
96
views
git autocompletions in Fish: how can I disable them or speed them up?
I'm running Fish shell (3.6.0) on Ubuntu. Let's say that I'm trying to run git add foo/bar.txt . I type:
git add foo
and then I press tab . Now the shell freezes up for a few seconds. Even pressing ...
1
vote
1
answer
71
views
where a variable inherit from, Fishshell
i'm trying to set an environment variable EDITOR and change it from default which is /usr/bin/nano but i can't use set -Ux due to this behavior
fish FAQ
How to find out which setting fish inherits ...
4
votes
3
answers
6k
views
How can I start tmux automatically in fish shell while connecting to remote server via ssh
I switched from bash to fish shell. I liked it and decided to use it on my servers also. How can I start tmux automatically on ssh connection? I followed this instruction for bash but fish shell is ...
0
votes
0
answers
38
views
Fish shell can't change directory over a Webdav resource through Rclone
Fish can't cd into a folder on a Webdav remote directory through Rclone:
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
drive ) ls
Documents/ Music/ ...
2
votes
4
answers
1k
views
fish shell alias only in specific directory
I am using fish and am working on a project with a script that's frequently invoked for build tasks called x.py. I'd like to create an alias that maps x to ./x.py. However, I only want this to apply ...
-1
votes
1
answer
966
views
WARNING: Running setxkbmap against an XWayland server
I'm using Fedora 37, tilix terminal emulator with fish shell.
Whenever I open a terminal, I get the warning
WARNING: Running setxkbmap against an XWayland server
How come? How to avoid it?
7
votes
2
answers
2k
views
kill %1 equivalent in fish
In bash, if I run kill %1, it kills a backgrounded command in the current shell (the most recent one, I believe).
Is there an equivalent of this in fish? I haven't been able to find it online in a bit ...
3
votes
2
answers
319
views
FISH: failed to execute process...variable exceeds the OS argument length limit
I keep getting an error when I cd to my project root directory that is on github:
> cd ~/go/src/github.com/mygithub/myapp
The below message auto pops up because I am using tide prompt which links ...
-1
votes
1
answer
199
views
Troubleshooting Oh-My-Fish configuration making fish really slow
Without changing the configuration my fish shell started to be really slow, like between 1 and 5 seconds to a simple ls command.
Note that the slow behaviour started suddenly. I have a local install ...
2
votes
2
answers
274
views
Is it possible to disable the & ampersand character in fish shell? (make escaping with \& unnecessary)
So it is possible to permanently disable the functionality of ?, making \? unnecessary, by enabling the qmark-noglob feature flag.
I would like to do the same thing for &, as I never use it for ...
0
votes
0
answers
473
views
direnv and environment variables
I'm trying to get autoactivation of conda/mamba environments working using direnv but I'm running across a problem that seems to be due to my lack of understanding of how bash scripts work with ...
0
votes
1
answer
45
views
Error in fish script turns on bracketed paste mode for ssh session?
When using a small fish function I’ve cobbled together (not a developer here, so please be gentle … 😌) for accessing a number of regularly needed ssh hosts, I’m seeing a strange effect: The bracket ...
18
votes
3
answers
9k
views
How to access bash aliases in fish
I am missing my bash aliases in fish, and don't want to manually convert all of them to fish functions.
How to get access to them all from within fish?
Bonus points if:
the solution supports an ...
4
votes
1
answer
106
views
Fish equivalent of Bash / readline's Ctrl-O "operate-and-get-next"
Readline and therefore Bash have a very useful command called operate-and-get-next, bound by default to Ctrl-O, that executes the current line, after selecting it from the history, and advances the ...
0
votes
1
answer
64
views
Copy files with different extensions to different basename with same extensions
I have 3 files
Original.js
Original.vue
Original.css
How can I easily copy them to
Copy.js
Copy.vue
Copy.css
Until now, i always just copied one by one, but if I could use something like copy ...
0
votes
0
answers
300
views
Trying to change "non command" color in kitty terminal (ver. 0.21.2) using the fish (ver. 3.3.1) shell with the oh-my-fish theme slacker
I've been trying to change the color of non-command such as the picture below (the uncompleated 'help')
link to the theme im using in omf: https://github.com/maqboolkhan/omf-theme-slacker
my kitty....
1
vote
1
answer
95
views
Unable to run git commands before shutdown
I would like to use systemd to accomplish this if possible. This is what I have done so far.
Wrote a script in fish that will stage, commit and push files to a repository. Script made executable with ...
0
votes
1
answer
49
views
Where is the default fish completion style defined or how do I style the fish completion options listing?
I'm using complete -c cl -o editz -f -xa '(cl -autocomplete 15 | sed "s/:/\\t/" | sed -r "s/^(.{60}).*/\1/")' to dynamically feed the latest 15 entires in a log program to fish for ...
0
votes
2
answers
909
views
How to run a command n times in the fish shell?
The fish documentation gives the following way to run a for loop.
for i in 1 2 3 4 5;
echo $i
end
Let us say I want to run a command 1000 times, How can I do it?
0
votes
1
answer
83
views
My fish prompt gets messed up when I add more set_color
I've been trying to make a custom fish prompt, but there's one problem that I can't seem to figure out how to fix.
I got this to work, but it's not exactly what I want, as I want the ash@cat-box to be ...
0
votes
0
answers
36
views
psub creates temp file as 'root' when fish is running under different user
Running the following from within a Docker container:
su postgres -s /usr/bin/fish -c "
echo 123 > /tmp/mypass
stat /tmp/mypass
stat $(echo 123 | psub)
"
Output of echo:
File:...
0
votes
3
answers
2k
views
Temporarily Set $PATH for a fish Shell Session From a Script
I want to prepend a couple directories to the $PATH variable temporarily so that I can set up a temporary development environment that I don't really want to change what other fish sessions see.
So ...
0
votes
1
answer
321
views
Terminal prompts have a mysterious [I] in it
I have been using fish shell for a while, but only recently got into playing around with the oh-my-fish framework and theming the prompt.
I cannot figure out what this [I] character means! In most ...
0
votes
1
answer
74
views
'fish_config browse' opens balena etcher instead of the default web browser
When I type fish_config browse in fish to configure it, it opens Balena etcher and not the web browser.
I am on Pop!_OS 22.04 lts and migrated from bash.
50
votes
3
answers
58k
views
How to make zsh completion show the first guess on the same line (like fish's)?
In Fish when you start typing, autocompletion automatically shows the first autocompleted guess on the line itself.
In zsh you have to hit tab, and it shows the autocompletion below. Is there anyway ...
0
votes
1
answer
60
views
Complete a positional argument only once
I'm trying to write a completion for a command (call it gs) that takes an SSH hostname as its first argument, and an arbitrary string as the second argument.
I've stolen this from the default SSH ...
5
votes
3
answers
4k
views
How to use fish on remote servers that have it installed without changing login shell?
I regularly ssh on several different servers, some of which don't have fish installed, but many do. I'd like to get fish as shell if available (changing midway is always tedious, and you lose the ...
1
vote
1
answer
90
views
Fish completion that depends on other flags
I have a command, that can connect to remote machines and so the completion should be based on which machine the user provided. That means that if the user pass -D DEVICE_ID I want the completion to ...
-1
votes
3
answers
3k
views
What does it mean to both append and prepend a value to a variable (in fish shell or in general)?
Per the fish shell documentation for the set command:
append: causes the values to be appended to the current set of values for the variable. This can be used with --prepend to both
append and ...
0
votes
0
answers
887
views
yt-dlp with external downloader has black frames
I have the following fish shell script for downloading a slice of a video using yt-dlp and ffmpeg
function yt-dlp-trim -d "Download a slice of a video with yt-dlp"
if test (count $argv) ...
0
votes
1
answer
589
views
Fish shell - what's wrong with this syntax?
I have a bash script which cats a heredoc string, and I'm running it inside a fish shell and then piping it to a source call, like so:
~/foo/baz:
1 #!/usr/bin/env bash
2
3 cat << EOS
4 ...
1
vote
1
answer
357
views
Fish shell - syntax for creating a switch statement which checks against an array of values
I'm studying the RBENV codebase, and I see that on line 116 of the rbenv-init file, a function is created which contains a switch statement. My hypothesis is that we check whether the value of the ...
1
vote
0
answers
154
views
Command line history in the fish shell suffering from short term memory issues
Over the last few months, I've been trying out the fish shell as my interactive shell. One issue that somewhat irritates me is that the shell occasionally forgets recent commands from its command ...
0
votes
2
answers
5k
views
Fish shell: How to disable help message?
When I start fish, it prints:
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
And then the prompt.
I've actually used fish for a while so I don't need ...
11
votes
2
answers
10k
views
How does history work in fish shell?
I'm a bash user, starting a new job at a place where people use fish shell.
I'm looking at the history command which I often use in bash. When I use it in fish I get a long list of my history which ...
1
vote
2
answers
122
views
Exit 'history' in fish
I recently switched from bash to fish. I like it, but I don't know how to exit, when I enter history. How do I do that?
-1
votes
2
answers
118
views
Use Git Version of mv/rm etc When in Repository
Git has its own versions of commands such as mv and rm that we really ought to use when doing these operations inside repositories.
However, I'm sure I'm not the only person who often forgets to do ...
3
votes
1
answer
230
views
Fish Completions - How to prevent file completions?
I am trying to write some completions for an in-house tool. We'll call it thetool.
Lots of the commands to thetool do not take a 'file' as an argument. I thought that --no-files and/or --exclusive ...
3
votes
1
answer
623
views
When pressing tab, how can I make fish complete to directory/ instead of directory/prefix?
I'm using fish shell. Let's say that I have a directory named books, containing files title-1, title-2 and title-3:
$ tree books
books/
├── title-1
├── title-2
└── title-3
0 directories, 3 files
If ...
2
votes
2
answers
172
views
Fish shell reports "math: Error: Missing operator" on tab completion
I noticed the error this morning, but I don't think I have changed anything last night, so I am very confused right now. Perhaps I updated some utilities on my system and it somehow broke the back ...
1
vote
1
answer
214
views
fish shell: universal variables and alias not shared between "contexts"
I use fish shell mainly from Rider IDE and iTerm2.
I've noticed that every task that implies saving something for future sessions will not operate transparently between the two aforementioned contexts....
0
votes
1
answer
260
views
How to switch language in fish shell?
I tried to switch languages in fish (eg. French as shell supports it) using sudo dpkg-reconfigure locales, but nothing changed.
Exporting LANG variable doing set --global --export LANG fr_FR.UTF-8 and ...
25
votes
7
answers
12k
views
Share environment variables between bash and fish
bash and fish scripts are not compatible, but I would like to have a file that defines some some environment variables to be initialized by both bash and fish.
My proposed solution is defining a ~/....
1
vote
1
answer
510
views
Fish EDITOR environment variable does not seem to work
I recently started using the Fish shell.
echo $EDITOR returns vim
But yet, when using programs that need to launch an editor and look for it in the EDITOR environment variable they don't seem to find ...
1
vote
1
answer
510
views
Get output of a command that uses curses
If I try to get the output (stdout) of a python program into a variable I do this:
set zpath (python something.py "$argv")
But if the program spawns a curses interface, it won't show.
The ...
0
votes
2
answers
740
views
fish shell: why does `file `which command`` work in zsh and bash, but not fish?
Before switching to fish shell, I frequently used various commands in zsh with which some_command. An example might be:
$ file `which zsh`
/opt/local/bin/zsh: Mach-O 64-bit executable arm64
/bin/zsh: ...
-1
votes
1
answer
608
views
New Fish-Shell Aliases are ignored
as explained in https://stackoverflow.com/a/2763014/2891692
i created for days many alias in my config file ~/.config/fish/config.fish
and it works.
every new alias i add today don't work.
Example of ...