Questions tagged [fish]
Fish is a unix shell with a clean design and a limited but powerful feature set.
219
questions
0
votes
1
answer
12
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 ...
-1
votes
2
answers
59
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?
1
vote
1
answer
15
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
22
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
33
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
37
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
39
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
155
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
144
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
46
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 ...
-1
votes
2
answers
2k
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
53
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
58
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
109
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 ...
2
votes
1
answer
257
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
146
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
92
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
99
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
212
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
340
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
411
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
282
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
173
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
94
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
514
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
353
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
55
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
182
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
140
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
582
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
356
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
218
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
521
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
347
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 ...
1
vote
1
answer
2k
views
Using Fish Shell, how can I export a variable from within a file?
We can export variables from the command line with set -x, but I'd like to know how to do this from within a file. The reason is that I'm organizing my $HOME directory according to the XDG convention, ...
-2
votes
3
answers
1k
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 ...
1
vote
1
answer
491
views
Oh-my-zsh "take" command - Is there an equivalent in Fish?
Oh-my-zsh has the take command which creates a directory and enters into it in one step. Is there an equivalent command for the fish shell?
I do know that I can do it with mkdir newDir && cd ...
1
vote
1
answer
560
views
Fish environment variables/$PATH in applications started from Desktop Environment?
I'm specifically trying to get NVM to work on Elementary OS with Fish and IntelliJ.
There is a fish script that works pretty well as long as I stay in the terminal. However, when I launch my IDE from ...
0
votes
1
answer
88
views
Function tab-completion not matching that of wrapped command
I've got a function defined in my fish shell:
function cl --wraps=cd
cd $argv && ls -l --color=auto
end
According to man function, the --wraps option "causes the function to inherit ...
1
vote
1
answer
135
views
fish - Maximum recursion depth reached with tab-complete
With my fish shell, I have defined the alias
alias black='command black -l 110'
When I type black in my shell and start to tab-complete, I get the error
complete: maximum recursion depth reached
...
0
votes
0
answers
247
views
Setting Fish Shell as default shell, prevents me from accessing commands
I used the following to set my default shell
chsh -s `which fish`
Which works great, but many commands such as brew and npm no longer works. Previously, accessing fish shell from zsh shell still ...
2
votes
4
answers
712
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 ...
0
votes
1
answer
381
views
Fish Shell: Start up script issue
I am not a coder or a programmer, I just try to learn but I have some limitations...
I'd like to mount a webdav resource when I logging into the session (virtual console), however I'd like to check if ...
2
votes
1
answer
253
views
Fish shell vi-mode is missing "repeat" command (dot/period/. key in Zsh)
I recently moved from Zsh to Fish, and I'm having a problem with vi-mode in Fish. There doesn't seem to be a "repeat" keybinding, like in Zsh's vi-mode (bound to the "dot" .). I ...
2
votes
1
answer
221
views
MacOS/iTerm2/fish arrow keys stops working after terminating a process with ctrl+c
I am using iTerm2 on my mac pro, and using fish as my shell. Every time I have a process running and I break it by pressing ctrl+c, the arrow keys stops working after and starts emitting ^[[A etc.
...
2
votes
2
answers
570
views
How do I add multiple fish functions in a single script?
I'm trying to shift to fish from zsh. As I've seen, load time of fish increases if I use alias. So I'd like to convert all of my alias into functions, but the thing is creating a function script for ...
1
vote
2
answers
301
views
How to display stdout of command in `less` with as few keystrokes as possible?
I often find myself piping a command's output into less because less is far superior for studying the output than the normal terminal.
While I can always append | less to every command, I was ...
1
vote
2
answers
322
views
How to enable auto logout in fish shell?
A quick google search says I could enable auto logout (for text consoles) by setting a TMOUT parameter. However, I discovered later that this would only work with the bash shell.
Is there a way I ...
2
votes
1
answer
111
views
Fish - remove file before download
I run fish shell and it gives an exception when I try to remove a file which is not found. I have the following script:
#!/usr/bin/fish
set files "/tmp/*.xlsx"
rm -f "$files"
...
1
vote
1
answer
163
views
fish - Run multiple abbreviations with another abbreviation
I have a few abbreviations that I want to run on one command.
Let's say given this config:
abbr command1 "echo 1"
abbr command2 "echo 2"
abbr command3 "echo 3"
I want ...