Last active
September 3, 2022 12:45
-
-
Save leonid-shevtsov/a114326b7072bfd67ea78df47717d407 to your computer and use it in GitHub Desktop.
Minimal fish prompt for VSCode
This file contains hidden or 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