.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "PROMPT_PWD" "1" "Nov 13, 2025" "4.2" "fish-shell" .SH NAME prompt_pwd \- print pwd suitable for prompt .SH SYNOPSIS .nf \fBprompt_pwd\fP .fi .sp .SH DESCRIPTION .sp \fBprompt_pwd\fP is a function to print the current working directory in a way suitable for prompts. It will replace the home directory with \(dq~\(dq and shorten every path component but the last to a default of one character. .sp To change the number of characters per path component, pass \fB\-\-dir\-length=\fP or set \fBfish_prompt_pwd_dir_length\fP to the number of characters. Setting it to 0 or an invalid value will disable shortening entirely. This defaults to 1. .sp To keep some components unshortened, pass \fB\-\-full\-length\-dirs=\fP or set \fBfish_prompt_pwd_full_dirs\fP to the number of components. This defaults to 1, keeping the last component. .sp If any positional arguments are given, \fBprompt_pwd\fP shortens them instead of \fI\%PWD\fP\&. .SH OPTIONS .INDENT 0.0 .TP \fB\-d\fP or \fB\-\-dir\-length\fP \fIMAX\fP Causes the components to be shortened to \fIMAX\fP characters each. This overrides \fBfish_prompt_pwd_dir_length\fP\&. .TP \fB\-D\fP or \fB\-\-full\-length\-dirs\fP \fINUM\fP Keeps \fINUM\fP components (counted from the right) as full length without shortening. This overrides \fBfish_prompt_pwd_full_dirs\fP\&. .TP \fB\-h\fP or \fB\-\-help\fP Displays help about using this command. .UNINDENT .SH EXAMPLES .INDENT 0.0 .INDENT 3.5 .sp .EX >_ cd ~/ >_ echo $PWD /home/alfa >_ prompt_pwd ~ >_ cd /tmp/banana/sausage/with/mustard >_ prompt_pwd /t/b/s/w/mustard >_ set \-g fish_prompt_pwd_dir_length 3 >_ prompt_pwd /tmp/ban/sau/wit/mustard >_ prompt_pwd \-\-full\-length\-dirs=2 \-\-dir\-length=1 /t/b/s/with/mustard >_ echo (prompt_pwd | string split /)[\-1] mustard >_ echo (string join / (prompt_pwd | string split /)[\-3..\-1]) s/with/mustard .EE .UNINDENT .UNINDENT .SH COPYRIGHT fish-shell developers .\" Generated by docutils manpage writer. .