Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Higlight slashes in the path to visualize the path components #432

Open
sudo-nice opened this issue Aug 23, 2018 · 7 comments
Open

Higlight slashes in the path to visualize the path components #432

sudo-nice opened this issue Aug 23, 2018 · 7 comments
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement help wanted

Comments

@sudo-nice
Copy link

sudo-nice commented Aug 23, 2018

Issuehunt badges

This is a feature request.

Please, compare these two screenshots:

scr1
scr2

Personally, I find it useful, and maybe you will like it too.
The method I use is buggy, as it can't handle % anywhere in the path:

diff --git a/pure.zsh b/pure.zsh
index e3813b7..fc96474 100644
--- a/pure.zsh
+++ b/pure.zsh
@@ -113,9 +113,8 @@ prompt_pure_preprompt_render() {
# Initialize the preprompt array.
  local -a preprompt_parts
    -
# Set the path.
-       preprompt_parts+=('%F{blue}%~%f')
+       preprompt_parts+=('%F{blue}${${(%):-%~}//\//%B/%b}%f')
# Add git branch and dirty status info.
  typeset -gA prompt_pure_vcs_info

There is a $40.00 open bounty on this issue. Add more on Issuehunt.

@sindresorhus
Copy link
Owner

I would rather do the inverse and slightly dim the path separators.

@mafredri
Copy link
Collaborator

mafredri commented Aug 23, 2018

So something like preprompt_parts+=('%F{blue}${${(%):-%~}//\//%F{24\}/%f%F{blue\}}%f')? It could be hard to come up with a good dimmed color.

@sudo-nice
Copy link
Author

It could be hard to come up with a good dimmed color.

Agree, I played with the background color, but nothing worked for me as good as a simple bold.

@sindresorhus
Copy link
Owner

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 2, 2019
@IssueHuntBot
Copy link

@IssueHunt has funded $40.00 to this issue.


@sudo-nice
Copy link
Author

I've grown into the realization that having the last path component highlighted is more useful for me.
scr

I do it this way:

function cwd() { print ${(D)PWD} }
function path_head() { print ${${"$(cwd)"%/*}} }
function esc_path_tail() { print ${${"$(cwd)"#"$(path_head)"}//\%/%%} } # escape '%'
function esc_path_head() { print ${$(path_head)//\%/%%} } # escape '%'
# ...
preprompt_parts+=('%F{${prompt_pure_colors[path]}}$(esc_path_head)%f%F{12}$(esc_path_tail)%f')

Feel free to reuse this snippet if you want to.

@TogoorooDev
Copy link

I can do this, should I make the slashes highlighted, or dimmed? Seems different people want different things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement help wanted
Projects
None yet
Development

No branches or pull requests

5 participants