Can 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 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 can I set environment variables to non-utf8 values? [closed]
In fish I want to set an environment variable to a non-utf8 value like \x80 (the character sequence of length one with the value 0x80, i.e., 128). I already triedset -x a \x80fish: Invalid token...
View ArticleHow do you dynamically reload fish config files as you would in bash?
I am looking for the equivalent of source .bashrc for Fish.
View ArticleHow do you disable fish shell's guessing autocompletion feature?
In bash, if you type something like:ls /etc/abcand hit <tab>, it will beep, and do nothing, basically letting you know that it couldn't figure out how to complete it. In the case of that specific...
View ArticleSyntax coloring with Vim and Fish-Shell
What is the best editor for fish scripts? I mean an editor which can properly highlight, indent and syntax check.I found the vim-fish project, but I am still scratching my head as to how to install it...
View ArticleList functions in fish config file?
How can I list all the functions I have saved in the config file?I tried functions | cat, but that listed a bunch of functions that are not in my config folder.
View ArticleFish shell: variable with last argument [closed]
What is a fish shell equivalent of mkdir -p foo/bar/baz/quux && cd $_?I know about $history[1], but here I need only last argument of the previous command.
View Article