Skip to content

Instantly share code, notes, and snippets.

@leonid-shevtsov
Last active September 3, 2022 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonid-shevtsov/a114326b7072bfd67ea78df47717d407 to your computer and use it in GitHub Desktop.
Save leonid-shevtsov/a114326b7072bfd67ea78df47717d407 to your computer and use it in GitHub Desktop.
Minimal fish prompt for VSCode
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