-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add prompt segment for current history mode: global vs. per-directory #2384
Comments
It appears that the That could be a nice, simple way to detect the mode within P10K and update the prompt accordingly. |
Concur! I use per-directory-history but never toggle to global because there is no clear indication which mode is being used. |
You can use a custom prompt segment for this. function prompt_my_history() {
if [[ $_per_directory_history_is_global == true ]]; then
p10k segment -b yellow -f red -t G
else
p10k segment -b yellow -f red -t L
fi
} Put this in See |
Wow, this is perfect and works like an absolute charm! Thank you for making it so easy! For @rwmitchell, and others in the future interested to know, here is the entirety of what I added to my
This will add the proposed segment only when the The result (for me) looks as follows: @romkatv If you think this segment or a simplified version might be more widely useful, I'd be happy to submit a PR for it. Otherwise, my feelings are not hurt :) Thanks again! |
I'm going to assume Roman is not going to add it because he's trying minimize complexity while maximizing only the most commonly used features. As it isn't hard to add custom segments, I've added (and dropped some) several of my own, it isn't necessary to add everyone's pet feature. While these do not need to be added to p10k, I love sharing ideas people come up with, either to use outright or to modify. The question becomes where to share them, that encourages community activity and easily discoverable by other p10k users. |
I added |
That's awesome! Thanks! |
The
per-directory-history
zsh plugin allows users to toggle between directory-specific command histories and overall command histories. This allows for much more rapid and effective history searching. It's awesome.However, it is kind of annoying to have to manually check my history to deduce which mode I'm in. E.g.
history | wc -l
--> huge number indicates "global history mode", while a smaller number indicates per-directory history mode. Note that simply scrolling through the last few commands is not always clear, as these may be generic, e.g.,ls -l
.In the P10K spirit of an info-packed prompt, it would be so useful to add a prompt element which concisely shows which mode your history is in. For example:
From a quick skim of your source code, it seems like the
POWERLEVEL9K_*_PROMPT_ELEMENTS
variables may be the most sensible place to set this. But maybe there's a better way.The text was updated successfully, but these errors were encountered: