Skip to main content

Path

Whatโ€‹

Display the current path.

Sample Configurationโ€‹

{
"type": "path",
"style": "powerline",
"powerline_symbol": "๎‚ฐ",
"foreground": "#ffffff",
"background": "#61AFEF",
"properties": {
"style": "folder",
"mapped_locations": {
"C:\\temp": "๎ž™"
}
}
}

Propertiesโ€‹

NameTypeDescription
folder_separator_iconstringthe symbol to use as a separator between folders - defaults to platform path separator
folder_separator_templatestringthe template to use as a separator between folders - defaults to ``
home_iconstringthe icon to display when at $HOME - defaults to ~
folder_iconstringthe icon to use as a folder indication - defaults to ..
windows_registry_iconstringthe icon to display when in the Windows registry - defaults to \uE0B1
styleenumhow to display the current path
mixed_thresholdnumberthe maximum length of a path segment that will be displayed when using Mixed - defaults to 4
max_depthnumbermaximum path depth to display before shortening when using agnoster_short, defaults to 1
max_widthnumbermaximum path length to display when using powerlevel, defaults to 0
hide_root_locationbooleanhides the root location if it doesn't fit in the last max_depth folders, when using agnoster_short - defaults to false
cycle[]stringa list of color overrides to cycle through to colorize the individual path folders, e.g. [ "#ffffff,#111111" ]
cycle_folder_separatorbooleancolorize the folder_separator_icon as well when using a cycle - defaults to false
folder_formatstringformat to use on individual path folders - defaults to %s
edge_formatstringformat to use on the first and last folder of the path - defaults to %s

Mapped Locationsโ€‹

Allows you to override a location with an icon/string. It validates if the current path starts with the specific elements and replaces it with the icon/string if there's a match. To avoid issues with nested overrides, Oh My Posh will sort the list of mapped locations before doing a replacement.

NameTypeDescription
mapped_locations_enabledbooleanreplace known locations in the path with the replacements before applying the style - defaults to true
mapped_locationsobjectcustom glyph/text for specific paths. Works regardless of the mapped_locations_enabled

setting.

For example, to swap out C:\Users\Leet\GitHub with a GitHub icon, you can do the following:

"mapped_locations": {
"C:\\Users\\Leet\\GitHub": "\uF09B"
}

Notesโ€‹

  • To make mapped locations work cross-platform, use / as the path separator, Oh My Posh will automatically match effective separators based on the running operating system.
  • If you want to match all child directories, you can use * as a wildcard, for example: "C:/Users/Bill/*": "$" will turn C:/Users/Bill/Downloads into $/Downloads.
  • The character ~ at the start of a mapped location will match the user's home directory.
  • The match is case-insensitive on Windows and macOS, but case-sensitive on other operating systems. This means that for user Bill, who has a user account Bill on Windows and bill on Linux, ~/Foo might match C:\Users\Bill\Foo or C:\Users\Bill\foo on Windows but only /home/bill/Foo on Linux.

Styleโ€‹

Style sets the way the path is displayed. Based on previous experience and popular themes, there are 10 flavors.

  • agnoster
  • agnoster_full
  • agnoster_short
  • agnoster_left
  • full
  • folder
  • mixed
  • letter
  • unique
  • powerlevel

Agnosterโ€‹

Renders each intermediate folder as the folder_icon separated by the folder_separator_icon. The first and the last (current) folder name are always displayed as-is.

Agnoster Fullโ€‹

Renders each folder name separated by the folder_separator_icon.

Agnoster Shortโ€‹

When more than max_depth levels deep, it renders one folder_icon (if hide_root_location is false, which means the root folder does not count for depth) followed by the names of the last max_depth folders, separated by the folder_separator_icon.

Agnoster Leftโ€‹

Renders each folder as the folder_icon separated by the folder_separator_icon. Only the first folder name and its child are displayed in full.

Fullโ€‹

Display the current working directory as a full string with each folder separated by the folder_separator_icon.

Folderโ€‹

Display the name of the current folder.

Mixedโ€‹

Works like Agnoster, but for any intermediate folder name that is short enough, it will be displayed as-is. The maximum length for the folders to display is governed by the mixed_threshold property.

Letterโ€‹

Works like Agnoster Full, but will write every folder name using the first letter only, except when the folder name starts with a symbol or icon. Specially, the last (current) folder name is always displayed in full.

  • folder will be shortened to f
  • .config will be shortened to .c
  • __pycache__ will be shortened to __p
  • โžผ folder will be shortened to โžผ f

Uniqueโ€‹

Works like Letter, but will make sure every folder name is the shortest unique value.

The uniqueness refers to the displayed path, so C:\dev\dev\dev\development will be displayed as C\d\de\dev\development (instead of C\d\d\d\development for Letter). Uniqueness does not refer to other folders at the same level, so if C:\projectA\dev and C:\projectB\dev exist, then both will be displayed as C\p\dev.

Powerlevelโ€‹

Works like Unique, but will stop shortening when max_width is reached.

Template (info)โ€‹

default template
{{ .Path }}

Propertiesโ€‹

NameTypeDescription
.Pathstringthe current directory (based on the style property)
.Parentstringthe current directory's parent folder which ends with a path separator (designed for use with style folder, it is empty if .Path contains only one single element)
.RootDirbooleantrue if we're at the root directory (no parent)
.Locationstringthe current directory (raw value)
.StackCountintthe stack count
.Writablebooleanis the current directory writable by the user or not