fish-shell/sphinx_doc_src/cmds/prompt_pwd.rst

38 lines
836 B
ReStructuredText
Raw Normal View History

.. _cmd-prompt_pwd:
prompt_pwd - Print pwd suitable for prompt
==========================================
Synopsis
--------
prompt_pwd
Description
-----------
prompt_pwd is a function to print the current working directory in a way suitable for prompts. It will replace the home directory with "~" and shorten every path component but the last to a default of one character.
To change the number of characters per path component, set $fish_prompt_pwd_dir_length to the number of characters. Setting it to 0 or an invalid value will disable shortening entirely.
Examples
--------
2018-12-19 11:14:04 +08:00
::
>_ cd ~/
>_ echo $PWD
/home/alfa
2018-12-19 11:14:04 +08:00
>_ prompt_pwd
~
2018-12-19 11:14:04 +08:00
>_ cd /tmp/banana/sausage/with/mustard
>_ prompt_pwd
/t/b/s/w/mustard
2018-12-19 11:14:04 +08:00
>_ set -g fish_prompt_pwd_dir_length 3
>_ prompt_pwd
/tmp/ban/sau/wit/mustard