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 change the ssh connection shell of pycharm on windows to the default...
I installed the fish shell on my server, but I found that it seems to be detrimental to my ability to connect to the server with ssh. When I connect to the server and run it, debugging the code,...
View ArticleFish Pipeline Status
In fish:if false | true | true echo "Fish thinks OK because of last status"else # But I... echo "Need the entire pipeline to be true"endBash has $PIPESTATUS.How does one test the integrity of a...
View ArticleHow to show content of a function in fish?
In fishshell, I can create and save a function very easy, like: function aaa echo helloendfuncsave aaaBut how to view the body of the function aaa from command line easily? Is there any way other...
View ArticleFISH Shell - Cannot `cd -` when extending builtin cd
I have a custom cd function that looks like:function cd -d "cd with auto conda activation" # set -gx OLDPWD (pwd) <-- uncommenting this does not resolve issue builtin cd $param $argv if test -f...
View ArticleMulti-line variables remove new line character - Fish
When I set any multiline text as a variable in fish, it removes the new line characters and replaces them with space, how can I stop it from doing that? Minimal complete example:~ ) set lines (cat...
View ArticleHow to pipe on a condition in Fish?
See previous question, How to pipe on a condition in Bash. I'm interested in the same construct for Fish, i.e. shorthand for:set check 0if test $check = 1 printf "foo\nbar\nbaz\n" | string match...
View ArticleHow can I fix Edit cancelled, no changes made in shell
I runkubectl edit deploymentto change the version of one of my pods (this commands opens a temp file in my text editor and then I usually edit and close this temp file) and even before I close this...
View ArticleCan I use nvim --remote to replace nvr?
I'm using neovim-remote/nvr to avoid nested instances of nvim when using the integrated terminal. This is the code:# config.fishif set -q NVIM # Avoid nested neovim instances with neovim-remote set -gx...
View ArticleAppend *multiple* paths to PYTHONPATH in fish
Here I read how to append to PYTHONPATH in fish, and that works fine for one string.However, if I do this:set --export PYTHONPATH $PYTHONPATH path1 path2I get this:>> import os>>...
View ArticleIs there a way to have fish-shell use GNU coreutils printf function?
Ran into an issue when running the following command in a fish shell:❯ printf '%q\n''André Previn & London Symphony Orchestra'%q: invalid conversion specificationI hadn't realized at first that...
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 ArticleHow to bind a key to just another key in fish
I am trying to bind the key sequence control-h (\ch in fish) to the right arrow key. I know how to bind it to backward-char with bind the normal way, but that poses an issue in my config, since I have...
View ArticleHow to load a .env file's environment variables into both Bash and Fish...
I want to have a .env file with a bunch of name-value pairs, like:VAR1=xxxVAR2=yyy# sample C include dir use caseINCLUDE_DIR=/etc/include/xxxI want these variables to be available in both bash and fish...
View ArticleHow to retrieve the current script's path in Fish shell
In bash, we can retrieve the current script's path by $0 variable, so if any script has a dependency resource which is under the same directory as the script directory, we can use it even when we're...
View ArticleMy fish is blind? (fish does not recognise any commands after setting it as...
I installed fish with homebrew on Mac OS Big Sur, Apple Silicon. Then I added /opt/homebrew/bin/fish to /etc/shells. When I now start fish from the default shell, it recognises all commands (like git...
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 Articlefish shell: Is it possible to conveniently strip extensions?
Is there any convenient way to strip an arbitrary extension from a file name, something à la bash ${i%%.*}? Do I stick to my friend sed?
View Article= 18.17.0 is required" despite using a higher Node.js version">Next.js error: "You are using Node.js 18.15.0. For Next.js, Node.js version...
I recently created a Next.js app using the CLI, and when I tried to run the development server with npm run dev, I encountered this error:You are using Node.js 18.15.0. For Next.js, Node.js version...
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 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 ArticleCeph CLI autocompletions in Fish shell
I couldn't find a way to set up autocompletion for the Ceph CLI in Fish Shell. Is there a simple way to enable them?
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 Article