Minimal fish prompt for VSCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt | |
if not set -q VSCODE_WS; or test $VSCODE_WS = '${workspaceFolder}' | |
# not vscode or no active workspace | |
set shortpath (prompt_pwd) | |
else | |
set shortpath (realpath --relative-to $VSCODE_WS .) | |
if test (string sub --length 2 $shortpath) = ".." | |
# working dir is outside of workspace | |
set shortpath (printf "🌍 %s" (prompt_pwd)) | |
else if test $shortpath = '.' | |
# working dir is the workspace root | |
set shortpath '🏠' | |
else | |
# working dir is within the workspace | |
set shortpath "🏠/$shortpath" | |
end | |
end | |
printf '%s ❯ ' $shortpath | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment