-
Notifications
You must be signed in to change notification settings - Fork 943
[Bugfix] Fix extra tilde when using truncate_with_folder_marker under $HOME #1271
base: master
Are you sure you want to change the base?
Conversation
truncate_with_folder_marker adds a tilde when it finds HOME, but POWERLEVEL9K_HOME_FOLDER_ABBREVIATION is also prepended, so if you're in a subdirectory of $HOME you get an extra tilde (although this does not occur if you're actually in $HOME) Without the change, the new test I added fails: ``` testHomeWithFolderMarkerWorks ASSERT:expected:<%K{004} %F{000}~/powerlevel9k-test %k%F{004}%f > but was:<%K{004} %F{000}~~/powerlevel9k-test %k%F{004}%f > ```
|
ah, I see what you mean. I can take a shot at fixing that as well. I filed #1272 to track it, if you have anything to add. FWIW, I'm using it for a specific purpose where I didn't like any of the other strategies, but the directories where I have folder markers aren't under $HOME so I didn't notice. |
Can you share extra details? What are the directories outside of your In my opinion this shortening strategy shouldn't have existed. Instead, Powerlevel9k should respect ZSH named directories, both static and dynamic. If you can shed some light on how you are using |
Yeah, that's right (ah, didn't realize you were an xoogler), my directory is i.e.: Semi-unrelated, but ideally I'd like to use the perforce vcs stuff and have that interact with the directory name. When I was using tcsh, my prompt was just |
Thanks for the explanation. I'll leave the discussion of p4/g4 integration for another time. As far as directory is concerned, here's what you can do in ZSH without any plugins or themes. First, start zsh like so: PROMPT='%~ ' zsh -df This will give you a simple prompt that contains just your current directory. Notice how your home directory is abbreviated as You can define a static named directory for citc. hash -d citc=/google/src/cloud/salty Now, if you are in This is static named directory. It's static because for every named directory of this kind we need to run There are also dynamic named directories, which allow you to have unlimited number of named directories whose names and targets depend on external data. They look like this: Static and dynamic named directories give you a lot of flexibility that doesn't require builtin support from Powerlevel9k. Plus, they integrate with ZSH seamlessly. Ideally, Powerlevel9k should show named directories in the prompt just like native ZSH prompt does it. Unfortunately, it doesn't work. I think making it work would be valuable, and it's also not difficult. FWIW, |
@mr-salty FYI: Powerlevel10k now supports named directories, both static and dynamic. All shortening strategies and other dir prompt options work properly when you are under a named directory. You don't need to do anything special to enable it. Just update Powerlevel10k, add |
truncate_with_folder_marker adds a tilde when it finds HOME, but
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION is also prepended, so if you're
in a subdirectory of $HOME you get an extra tilde (although this does not
occur if you're actually in $HOME)
Without the change, the new test I added fails: