2020-10-05 02:33:12 -07:00
|
|
|
---
|
|
|
|
id: path
|
|
|
|
title: Path
|
|
|
|
sidebar_label: Path
|
|
|
|
---
|
|
|
|
|
|
|
|
## What
|
|
|
|
|
|
|
|
Display the current path.
|
|
|
|
|
|
|
|
## Sample Configuration
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"type": "path",
|
|
|
|
"style": "powerline",
|
2020-10-15 23:37:43 -07:00
|
|
|
"powerline_symbol": "\uE0B0",
|
2020-10-05 02:33:12 -07:00
|
|
|
"foreground": "#ffffff",
|
|
|
|
"background": "#61AFEF",
|
|
|
|
"properties": {
|
2020-11-19 11:30:29 -08:00
|
|
|
"style": "folder",
|
2021-05-02 05:32:48 -07:00
|
|
|
"mapped_locations": {
|
|
|
|
"C:\\temp": "\ue799"
|
|
|
|
}
|
2020-10-05 02:33:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
2021-03-15 09:49:13 -07:00
|
|
|
- folder_separator_icon: `string` - the symbol to use as a separator between folders - defaults to platform path separator
|
2022-05-12 11:16:33 -07:00
|
|
|
- folder_separator_template: `string` - the [template][templates] to use as a separator between folders - defaults to ``
|
2020-10-16 11:07:38 -07:00
|
|
|
- home_icon: `string` - the icon to display when at `$HOME` - defaults to `~`
|
|
|
|
- folder_icon: `string` - the icon to use as a folder indication - defaults to `..`
|
|
|
|
- windows_registry_icon: `string` - the icon to display when in the Windows registry - defaults to `\uE0B1`
|
2020-10-05 02:33:12 -07:00
|
|
|
- style: `enum` - how to display the current path
|
2021-02-09 02:57:32 -08:00
|
|
|
- mixed_threshold: `number` - the maximum length of a path segment that will be displayed when using `Mixed` -
|
|
|
|
defaults to `4`
|
2022-02-28 21:39:52 -08:00
|
|
|
- max_depth: `number` - maximum path depth to display before shortening when using `agnoster_short` - defaults to `1`
|
|
|
|
- hide_root_location: `boolean` - hides the root location if it doesn't fit in the last `max_depth` folders, when using
|
|
|
|
`agnoster_short` - defaults to `false`
|
2020-10-05 02:33:12 -07:00
|
|
|
|
2021-05-02 05:32:48 -07:00
|
|
|
## Mapped Locations
|
|
|
|
|
|
|
|
Allows you to override a location with an icon. It validates if the current path **starts with** the value and replaces
|
2021-09-18 13:03:00 -07:00
|
|
|
it with the icon if there's a match. To avoid issues with nested overrides, Oh My Posh will sort the list of mapped
|
2021-05-02 05:32:48 -07:00
|
|
|
locations before doing a replacement.
|
|
|
|
|
|
|
|
- mapped_locations_enabled: `boolean` - replace known locations in the path with the replacements before applying the
|
2021-09-18 13:03:00 -07:00
|
|
|
style - defaults to `true`
|
|
|
|
- mapped_locations: `object` - custom glyph/text for specific paths. Works regardless of the `mapped_locations_enabled`
|
2021-07-24 10:49:01 -07:00
|
|
|
setting.
|
2021-05-02 05:32:48 -07:00
|
|
|
|
|
|
|
For example, to swap out `C:\Users\Leet\GitHub` with a GitHub icon, you can do the following:
|
|
|
|
|
|
|
|
```json
|
|
|
|
"mapped_locations": {
|
|
|
|
"C:\\Users\\Leet\\GitHub": "\uF09B"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-09-18 13:03:00 -07:00
|
|
|
### Notes
|
|
|
|
|
|
|
|
- Oh My Posh will accept both `/` and `\` as path separators for a mapped location and will match regardless of which
|
|
|
|
is used by the current operating system.
|
|
|
|
- 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.
|
|
|
|
|
2020-10-05 02:33:12 -07:00
|
|
|
## Style
|
|
|
|
|
2020-12-24 13:17:00 -08:00
|
|
|
Style sets the way the path is displayed. Based on previous experience and popular themes, there are 5 flavors.
|
2020-10-05 02:33:12 -07:00
|
|
|
|
|
|
|
- agnoster
|
2020-11-11 04:53:53 -08:00
|
|
|
- agnoster_full
|
2020-12-17 03:10:01 -08:00
|
|
|
- agnoster_short
|
2021-12-11 11:37:14 -08:00
|
|
|
- agnoster_left
|
2020-10-05 02:33:12 -07:00
|
|
|
- full
|
|
|
|
- folder
|
2021-02-09 02:57:32 -08:00
|
|
|
- mixed
|
2021-07-13 11:15:53 -07:00
|
|
|
- letter
|
2022-02-09 01:06:28 -08:00
|
|
|
- unique
|
2020-10-05 02:33:12 -07:00
|
|
|
|
|
|
|
### Agnoster
|
|
|
|
|
|
|
|
Renders each folder as the `folder_icon` separated by the `folder_separator_icon`.
|
2021-12-11 11:37:14 -08:00
|
|
|
Only the current folder name is displayed at the end.
|
2020-10-05 02:33:12 -07:00
|
|
|
|
2020-11-11 04:53:53 -08:00
|
|
|
### Agnoster Full
|
|
|
|
|
|
|
|
Renders each folder name separated by the `folder_separator_icon`.
|
|
|
|
|
2020-12-17 03:10:01 -08:00
|
|
|
### Agnoster Short
|
|
|
|
|
2022-02-28 21:39:52 -08:00
|
|
|
When more than `max_depth` levels deep, it renders one `folder_icon` (if `hide_root_location` is `false`) followed by
|
|
|
|
the names of the last `max_depth` folders, separated by the `folder_separator_icon`.
|
2020-12-17 03:10:01 -08:00
|
|
|
|
2021-12-11 11:37:14 -08:00
|
|
|
### Agnoster Left
|
|
|
|
|
|
|
|
Renders each folder as the `folder_icon` separated by the `folder_separator_icon`.
|
|
|
|
Only the root folder name and it's child are displayed in full.
|
|
|
|
|
2020-10-05 02:33:12 -07:00
|
|
|
### Full
|
|
|
|
|
2020-12-24 13:17:00 -08:00
|
|
|
Display `$PWD` as a string.
|
2020-10-05 02:33:12 -07:00
|
|
|
|
|
|
|
### Folder
|
|
|
|
|
|
|
|
Display the name of the current folder.
|
2021-02-09 02:57:32 -08:00
|
|
|
|
|
|
|
### Mixed
|
|
|
|
|
|
|
|
Works like `Agnoster Full`, but for any middle folder short enough it will display its name instead. The maximum length
|
|
|
|
for the folders to display is governed by the `mixed_threshold` property.
|
2021-07-13 11:15:53 -07:00
|
|
|
|
|
|
|
### Letter
|
|
|
|
|
2021-10-15 17:14:34 -07:00
|
|
|
Works like `Full`, but will write every subfolder name using the first letter only, except when the folder name
|
|
|
|
starts with a symbol or icon.
|
|
|
|
|
|
|
|
- `folder` will be shortened to `f`
|
|
|
|
- `.config` will be shortened to `.c`
|
|
|
|
- `__pycache__` will be shortened to `__p`
|
|
|
|
- `➼ folder` will be shortened to `➼ f`
|
2021-12-17 13:48:41 -08:00
|
|
|
|
2022-02-09 01:06:28 -08:00
|
|
|
### Unique
|
|
|
|
|
|
|
|
Works like `Letter`, but will make sure every folder name is the shortest unique value.
|
|
|
|
|
2022-03-02 07:09:12 -08:00
|
|
|
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`.
|
|
|
|
|
2022-02-01 03:10:46 -08:00
|
|
|
## Template ([info][templates])
|
2021-12-17 13:48:41 -08:00
|
|
|
|
2022-02-01 03:10:46 -08:00
|
|
|
:::note default template
|
|
|
|
|
|
|
|
``` template
|
|
|
|
{{ .Path }}
|
|
|
|
```
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
- `.Path`: `string` - the current directory (based on the `style` property)
|
2022-08-02 23:39:49 -07:00
|
|
|
- `.Parent`: `string` - the current directory's parent folder (designed for use with style `folder`)
|
2022-05-15 22:27:50 -07:00
|
|
|
- `.Location`: `string` - the current directory (raw value)
|
2021-12-17 13:48:41 -08:00
|
|
|
- `.StackCount`: `int` - the stack count
|
2022-05-15 22:27:50 -07:00
|
|
|
- `.Writable`: `boolean` - is the current directory writable by the user or not
|
2021-12-17 13:48:41 -08:00
|
|
|
|
2022-04-20 09:43:59 -07:00
|
|
|
[templates]: /docs/configuration/templates
|