Displaying 3 directories up in the Fish Shell prompt
Today, I migrated over from
zsh was feeling old and unresponsive, launch your terminal and wait for tens of seconds for the prompt to appear levels of slow.
The fact that I'd started using it immediately with oh-my-zsh and spaceship-prompt without learning how it can be configured without those probably did not help the matters either.
It looked ultra-modern back when I migrated over from
bash a lifetime ago but I'm currently in my minimalist period.
I will try to keep my fish config pure, no plugin frameworks or anything.
fish seems approachable to tinker with so I'll probably never feel the need.
Aforementioned spaceship-prompt displays the current directory and at most 2 directories up by default.
Here's how it looks (
mkdir && cd);
~ δ take foo ~/foo δ take bar ~/foo/bar δ take baz foo/bar/baz δ take quux bar/baz/quux δ pwd /home/yigit/foo/bar/baz/quux
Fish documentation was more than enough to set things up, so I just wanted to mention how I got the prompt working without delving deep into how to configure the whole shell.
[-3..-1] was a
tail -n3 call but I got a last minute help from nice people on the fish gitter channel.
# ... snip # string and prompt_pwd are fish builtins! set -l cwd $cyan (string join / (string split -rn -m3 / (prompt_pwd))[-3..-1]) echo $cwd $normal ' '
My whole configuration is available on my dotfiles repository if you want to take a look around.