powerlevel10k/mkdocs/features/current_directory.md

1.3 KiB

Current directory that just works

The current working directory is perhaps the most important prompt segment. Powerlevel10k goes to great length to highlight its important parts and to truncate it with the least loss of information when horizontal space gets scarce.

Powerlevel10k Directory Truncation

When the full directory doesn't fit, the leftmost segment gets truncated to its shortest unique prefix. In the screencast, ~/work becomes ~/wo. It couldn't be truncated to ~/w because it would be ambiguous (there was ~/wireguard when the session was recorded). The next segment -- projects -- turns into p as there was nothing else that started with p in ~/work/.

Directory segments are shown in one of three colors:

  • Truncated segments are bleak.
  • Important segments are bright and never truncated. These include the first and the last segment, roots of Git repositories, etc.
  • Regular segments (not truncated but can be) use in-between color.

Tip: If you copy-paste a truncated directory and hit TAB, it'll complete to the original.

Troubleshooting: Directory is difficult to see in prompt when using Rainbow style.