Fish shell: how to exit on error (bash set -e)
On bash you can use set -e inside a script in order to exit on error:set -ecd unexisting-folderecho "this line will not be printed"But on fish shell set -e is used to erase variables:set FOO barset -e...
View ArticleCan 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 BASHGetting the source directory of a Bash script from...
View ArticleHow 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...
View ArticleHow to stop Fish shell store critical information
I really like fish auto completion but I don't want to store any parameters in it, I know I can use --private or -P, but it only remove the history only when the terminal closed.How to make sure fish...
View ArticleStart my Fish shell always from home, rather than the previous location?
I use the Fish shell, using the config from this dotfiles repository: https://github.com/kevinrenskers/dotfiles/tree/main/fish.The problem is that whenever I open a new tab in my terminal, that it...
View ArticleHow do I use Fish's Alt bindings using Kitty on macOS
I acquired a macOS machine for the first time, and I can't figure out how to use commands such as alt+E to open the current command in $EDITOR.I don't want to remap the ⌘ key to alt system-wide, but I...
View ArticleProblem with uv autocompletion in Fish shell after activating Mise
I’m trying to set up autocompletion for uv in Fish shell while using Mise to manage my environment. Mise has been installed correctly, and I'm using Fish as my terminal shell. However, autocompletion...
View Articlefish shell suggestions messing up integrated terminal in vs code
I have fish shell installed with Cygwin on windows 10. to use fish shell as an integrated terminal in vs code I added following settings"terminal.integrated.shell.windows":...
View ArticleErrors when trying to run and setup rustlings
While following the steps on the Rustlings website, I encountered an error: terminal output. I simply ran the provided command as instructed, without altering anything. How can I resolve this issue?...
View ArticleHow to add Brew to path, Fish on Ventura
I've got Fish installed on Ventura (via the installer) as my default Shell. I've also installed Brew (via the installer).I've seen instructions for how to add it to .zsh profile, but how / where do I...
View ArticleCan I shorten branch names in my terminal in fish
My question is basically this, but for fish, as the solution given there does not apply for thisCurrently my fish terminal often looks like><> ~r/f/d/config on...
View ArticleZipping for loop in fish shell (loop over multiple lists)
I often write ad-hoc loops straight into the command-line to run a bunch of experiments. It's always a one-time thing, so writing a script file for it is unwanted overhead.Often, though, I'd like to...
View ArticleCan fish shell's autosuggestion keybindings be customized?
There are two keybindings to accept a Fish suggestion: ctrl-f and right arrow. But these require using pinkies and/or leaving the home row.I'd rather use something easier to access, like shift+enter....
View ArticleFish shell: Shortcut for accept and run command suggestion
is it possible to create a shortcut such as "Shift+Return" to accept and run the displayed suggestion?The default key-bindings require pressing the arrow keys, which involve a movement away from the keys.
View ArticleHow to bind Ctrl-Enter in fish?
In order to configure a user binding (version 2.2.0), it must be in the fish_user_key_bindings function:function fish_user_key_bindings bind \n 'commandline -f accept-autosuggestion execute'endThis...
View ArticleIn fish shell, how to set a variable with default fallback?
I'm looking for the equivalent of the following bash syntax, but for the fish shell:local datafile="${_Z_DATA:-$HOME/.z}"i.e define a local variable that will take the value of $_Z_DATA if this one is...
View ArticleHow to add entry to fish shell history?
In my fish function, I'm evaluating constructed commandline viaeval (commandline), specifically - I'm looking for some file name from fzf, and then analyze if commandline was prepended with vim. If it...
View ArticleIn Fish, how do I check that two paths are the same?
I'm trying to write an if statement that checks to see if two variables refer to the same file or directory. I can't simply compare the strings, because I want two different strings that refer to the...
View Articlefish_add_path in config.fish: The expanded command was empty when trying to...
Hello I want to use FISH as my main shell and I have to prepend some directories/files to $PATH. I followed the guide on the ArchLinux wiki for prepending to $PATH but I ran into issues.This is the...
View Articlefish shell: Glob function?
When I migrated to fish from bash, I found glob patterns like "tmp[0-9][0-9].pdf" aren't supported. Then, recently fish has stopped to support the ? wildcard:$ fish --versionfish, version 4.0.0$ ls...
View ArticleIntellij Fish Integration is broken
Whenever I launch a terminal using my fish path (usr/bin/fish) it only displays following error:Cannot open FishFailed to start [/usr/bin/fish, --init-command=source...
View ArticleHow do I clear an entire multiline prompt in the fish shell?
I accidentally pasted many, many lines of text into my prompt.If I hold down C-u or C-k I’ll still be waiting a long time to clear everything.Is there a keystroke combination that will clear the entire...
View ArticleIssue in command substitution in fish
I'm trying to compile a C code (that was generated using Cython) as followsgcc (uv run python3-config --cflags --ldflags) some_file.c -o some_file.oHowever, I don't think substitution is working in...
View ArticleWhy does Fish shell have dark blue as the default color for directories
Is it just me?I have just installed fish using brew install fish and I'm using iTerm2.The color is absolutely unreadable. How do I change it to something nicer?
View ArticleFish Interactive Shell full path
Is there a way in the Fish Interactive shell for the full path to be displayed. Currently when I navigate to a directory I get the following shell.millermj@Dodore ~/o/workspacebut I would rather...
View ArticleCan I use Bash autocompletions for kubectl in fish?
Does anybody use fish shell with Kubectl commands? This Bash completionsource <(kubectl completion bash | sed 's/kubectl/k/g')works like dizzying charm for Bash. But how to do that same thing in...
View ArticleHow do I enable "!!" in fish?
I often used $ sudo !! while using bash. After switching to fish, I noticed this no longer works. Due to search engines not supporting search for special characters, this has been particularly...
View ArticleHow to find orphaned files with a fish shell script
In a Fish Shell script, how can I recursively find files ending in: .xmp, .pp3, .out.pp3 that do not have an accompanying image file. The result should be written into a variable.If I have the...
View ArticleRead file lines into list
How come $VARS doesn't contain ('testing', 'second') in the following example:~ ❯❯❯ /bin/cat ttestingsecond~ ❯❯❯ /bin/cat t | read -L -a VARS~ ❯❯❯ echo $VARStesting~ ❯❯❯I thought that -L is supposed to...
View ArticleHow to override (decorate) a builtin fish function
I would like to silence the printf that is found on line 9 of /usr/share/fish/functions/__fish_move_last.fish because I find it annoying.How can I do that without copying the entire function over?If I...
View Article