fish shell --- how to simulate or implement a hash table, associative array,...
I am migrating from ksh to fish. I am finding that I miss the ability to define an associative array, hash table, dictionary, or whatever you wish to call it. Some cases can be simulated as inset...
View ArticleHow do I change the colour of directory listings with oh-my-fish?
I've recently decided to give the fish shell a shot and also started using oh-my-fish. The problem I'm having is that I can't figure out how to change the color of directory listings when running a...
View ArticleHow do I translate this `for` loop for the fish shell?
I'm translating a script from Z shell to Fish, and I've got this one part I can't figure out how to translate: for (( i=0; i < $COLUMNS; i++ )); do printf $1 doneThe only documentation for for loops...
View ArticleIn fish shell, how can I put two conditions in an if statement?
What I want to do using bash:> if true; then echo y; else echo n; fiy> if false; then echo y; else echo n; fin> if false || true; then echo y; else echo n; fiyNow trying with fish:> if...
View ArticleGit stash: How to stash tracked files into a single stash via script?
I often do something like git add/checkout/stash -- (find -name "*.extension").For example, to revert all text files or all images.It works fine with add and checkout.When using add, untracked files...
View ArticleWhy does the or operator in fish seem to not work
function shapeshift argparse 'h/help' -- $argv if not set -q argv[1] $argv or if set -q _flag_help echo "Shapeshift lets you change into another root system." echo "It is a simple tool that mounts, and...
View ArticleFish shell: how to disable "git status" in prompt?
I love Fish shows me "git status" in the prompt. However, it doesn't work well for really large git repos because it's very slow. How can I disable this feature based on the directory's name? Thanks!
View ArticleFish 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 ArticleFish Shell: How can I customize the colors for the autocomplete feature?
I started using Fish (and oh-my-fish) a couple of weeks ago and one of the things that I find somewhat visually hard is the default background color of the autocomplete options (see the purple...
View ArticleIs it possible to setup FISH alias based on different OS or available command?
I see Define an alias in fish shell, and I know how to setup alias and/or functions,But is it possible to setup different alias target based on OS? Maybe use function?What I experience isn't standard I...
View ArticleHow to use bash functions with fish
I have few bash functions like#!/bin/shgit-ci() { ...}When I was not using fish I had a source ~/.my_functions line in my ~/.bash_profile but now it doesn't work.Can I use my bash functions with fish?...
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 ArticleHow to use fish aliases in bash scripts
I have a bash script and I want to use a command in it, that I defined in my config.fish like this:alias setbg='feh --bg-fill'However when I use the command in my bash script, I get:setbg: command not...
View Article