zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.95k stars 126 forks source link

feat: Add {file} formatter #421

Closed psprint closed 1 year ago

psprint commented 1 year ago

Description

A new formatter function to allow pretty printing of file names with extension.

Motivation and Context

I wanted to have extension of a file colorized without complex expressions like {file}$q:r{ext}$q:e. The new formatter handles this automatically, via {file}$q, and handles up to two extensions with different colors.

Related Issue(s)

Usage examples

Before: 2022-11-09-162249_1911x510_scrot

After: 2022-11-09-162154_1918x538_scrot

How Has This Been Tested?

I've run checkmake github release installation and +zinit-message {file}somefile.tar.gz function.

Types of changes

Checklist:

psprint commented 1 year ago

Could the pr be merged, @vladdoster ? It's a safe change as it applies only to messages from +zinit-message

vladdoster commented 1 year ago

Why does it make a file three different colors?

psprint commented 1 year ago

To make extensions easily recognizable, with the ….tar.gz and similar.

psprint commented 1 year ago

@vladdoster: I could make the colors to be applied in a different way, e.g.: 2 colors instead of 3… Is that ok for the PR to be merged?