Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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