A way to truncate the current folder name if too long? #4533
-
|
Hi, I'm looking for a way to modify the configuration for the Path segment so that if the folder name is over a certain length it truncates it, preferably with a "...", as some folder names end up taking up too much real estate: My current configuration is using My current Path segment configuration: {
"type": "path",
"style": "powerline",
"powerline_symbol": "\ue0b0",
"foreground": "p:black",
"background": "p:yellow",
"template": " \uea83 {{ path .Path .Location }} ",
"properties": {
"style": "folder",
"max_width": 10
}
},Perhaps there is something I can do in the template for this? Sorry, I am still new. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
@Adam-Kay You can do this using the template function |
Beta Was this translation helpful? Give feedback.
-
|
Is there some way to truncate in the middle? With abbrev it shows just the beginning of the path, but I'd like to see at least a part of the beginning and for sure the current working directory. It could be nice if only the middle part could be truncated when it's too long, leaving the 3 dots instead. |
Beta Was this translation helpful? Give feedback.


@Adam-Kay You can do this using the template function
truncorabbrevfrom sprig's string functions.