Questions tagged [fish]
Fish is a unix shell with a clean design and a limited but powerful feature set.
235
questions
1
vote
3
answers
54
views
In Fish, how do I cd to the closest parent with a .git directory?
I use Fish shell. Sometimes, I find myself in a child directory of a child directory of a child directory, several layers deep, and I want to return to the closest parent with a .git directory, as ...
0
votes
2
answers
79
views
I have to run eval $(/opt/homebrew/bin/brew shellenv) every time I start my pc for the terminal to recognise it
I use the Fish shell on OSX and installed brew.
Now I notice everytime I start my mac I need to run the eval $(/opt/homebrew/bin/brew shellenv) command again to make it recognice brew.
I also noticed ...
0
votes
1
answer
58
views
fish 'Invalid redirection target' error
This command works well in Bash and Zsh:
expac -H M "%011m\t%-20n\t%10d" $(comm -23 <(pacman -Qqen | sort) <({ pacman -Qqg xorg; expac -l '\n' '%E' base; } | sort -u)) | sort -n
But ...
1
vote
1
answer
39
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'...
1
vote
2
answers
163
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
92
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 ...
0
votes
0
answers
40
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/ ...
-1
votes
1
answer
1k
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?
3
votes
2
answers
488
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
258
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 ...
0
votes
0
answers
606
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
55
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 ...
4
votes
1
answer
142
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
85
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
379
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
103
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
74
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
1k
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
118
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
41
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
1
answer
79
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.
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 ...
1
vote
1
answer
97
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 ...
0
votes
1
answer
677
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
422
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
187
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
6k
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 ...
1
vote
2
answers
131
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
156
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
246
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
699
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
179
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
228
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
310
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 ...
1
vote
1
answer
564
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
574
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
842
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
669
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 ...
1
vote
1
answer
338
views
fish: bind ctrl+space to undo in terminal command line
abbr -a gc git commit
After expanding gc via pressing space, I want to undo via pressing ctrl+space in fish shell.
How do i do that?
-1
votes
4
answers
142
views
fish: cd to the most recently modified child directory
related to this post, cd to the most recently modified child directory
bash cd "$(\ls -1dt ./*/ | head -n 1)"
zsh cd ./*(/om[1])
changes to the most recently modified directory.
But there ...
0
votes
0
answers
958
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) ...
2
votes
1
answer
723
views
Keep cursor/prompt vertically centered in ZSH/FISH
I was wondering if there is an easy way to configure ZSH (I am using oh-my-zsh) and/or FISH (just started fiddling with this) to not keep the cursor/promt at the bottom of the terminal as soon an the ...
3
votes
0
answers
90
views
Sharing fish configuration across computers
I'm trying to share configurations across my computers (macOS and WSL2). Most of my configurations (abbreviations, plugins configuration) are by default in fish_variables which is meant to be ...
0
votes
2
answers
342
views
Fish 3.3.1 shell: how do I negate the results of a string match?
as above.
basically I want to implement something like
if not match then
do these things
else
do these other things
fi
Thanks
2
votes
1
answer
233
views
How do I extract variables from a list in fish?
So, I recently downloaded a cli which shares a lot of commands similar to linux.
Like mega-login : login & mega-logout :logout
and I am too tired of writing mega every time I need to use the cli.
...
3
votes
1
answer
917
views
XDG_DATA_DIRS env variable using two separator types in fish shell
After doing an OS upgrade (opensuse leap 15.2 -> 15.3), my XDG setup broke. Among other things, my XDG_DATA_DIR env var uses two different value separators: : and .
Current XDG_DATA_DIRS value:
/...
2
votes
3
answers
776
views
Is there a way to validate a completion file?
I have tool that is able to create a completion file for bash, zsh and fish. I normally use zsh, but i cannot get this completion file to work on zsh. So as a test i installed fish and created the ...
2
votes
2
answers
311
views
What's the correct format for MAKEFLAGS when using Fish shell?
To improve compile times, the Arch wiki states,
Users with multi-core/multi-processor systems can specify the number
of jobs to run simultaneously. This can be accomplished with the use
of nproc to ...
0
votes
0
answers
1k
views
fzf not using `$FZF_DEFAULT_COMMAND`
I'm trying to get fzf to use rg --files as its command for searching, but can't seem to get it to use the $FZF_DEFAULT_COMMAND environment variable, as described in the docs.
I use fish as my shell, ...
2
votes
0
answers
497
views
Fish Shell Showing /usr/bin/git after every command. Any way to remove this? [closed]
Been trying to find where this is coming from and I can't seem to figure it out. I know that It's the location of my git install, but not much else. Is it echoing somewhere from some sort of fish ...