sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.22k stars 977 forks source link

Feature/Question: Show directory instead of full path #562

Closed jasonvarga closed 4 years ago

jasonvarga commented 4 years ago

Hi! Not a bug, but just a question.

Is it possible to just show the current directory instead of the entire path?

i.e. myproject instead of ~/projects/myproject

mafredri commented 4 years ago

This would be solvable by #460, if it gets implemented (but nobody is working on it atm).

Now, if you don't mind making your own changes / forking, it's a simple one line change 😄:

diff --git pure.zsh pure.zsh
index 2cbd7d0..d8326ae 100644
--- pure.zsh
+++ pure.zsh
@@ -135,7 +135,7 @@ prompt_pure_preprompt_render() {
    [[ -n $prompt_pure_state[username] ]] && preprompt_parts+=($prompt_pure_state[username])

    # Set the path.
-   preprompt_parts+=('%F{${prompt_pure_colors[path]}}%~%f')
+   preprompt_parts+=('%F{${prompt_pure_colors[path]}}%1~%f')

    # Git branch and dirty status info.
    typeset -gA prompt_pure_vcs_info
jasonvarga commented 4 years ago

I don't mind at all. That works beautifully, thank you!