How to short the file path before the command ?The command line prefix or the file path is too long. #16266

Closed
opened 2026-01-31 05:02:08 +00:00 by claunia · 1 comment
Owner

Originally created by @caesarding07 on GitHub (Dec 26, 2021).

image
As you can see, the file path before my command is too long. So I can't put any of my commands on a line in my little window. Can someone help me solve this problem?

Originally created by @caesarding07 on GitHub (Dec 26, 2021). ![image](https://user-images.githubusercontent.com/48940492/147400228-aa613e73-0777-4db2-8ea3-1153ad06f97f.png) As you can see, the file path before my command is **too long**. So I can't put any of my commands **on a line** in my little window. Can someone help me solve this problem?
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 05:02:08 +00:00
Author
Owner

@237dmitry commented on GitHub (Dec 26, 2021):

Imho, the best way is to write your own prompt function in $profile. Something like:

function prompt
{
   "$([char]27)[38;5;31m$($PWD.Path)`n$([char]27)[0m PS $([char]27)[38;5;41m> $([char]27)[0m"
}

This is a very simple example

@237dmitry commented on GitHub (Dec 26, 2021): Imho, the best way is to write your own prompt function in `$profile`. Something like: ``` function prompt { "$([char]27)[38;5;31m$($PWD.Path)`n$([char]27)[0m PS $([char]27)[38;5;41m> $([char]27)[0m" } ``` This is a very simple example
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16266