https://github.com/nojhan/liquidprompt#known-limitations-and-bugs (LP_DISABLED_VCS_PATH) and https://github.com/arialdomartini/oh-my-git#disabling-oh-my-git offer each a possibility to disable the git-prompt features for certain folders/git repos.
In the spirit of a pretty, minimal and fast ZSH prompt, I would actually expect such a possibility. Otherwise this prompt is not an option for me since git is very slow via sshfs and makes your slim prompt unusable slow.
I hope you find it worthwhile adding a way to disable git feature in certain situations.
Does commenting this line help?
Out of interest, would you mind telling me the output of the following commands (the timings) over sshfs:
time command git rev-parse --abbrev-ref @'{u}'
time command git rev-list --left-right --count HEAD...@'{u}'
time command git rev-parse --show-toplevel
The two first commands are the only ones called explicitly by pure, all other git commands are either run by vcs_info or asynchronously.
PS. Can you tell me your use case, e.g. why are you browsing git repositories over sshfs?
Thanks for your feedback. I appreciate your efforts.
Commenting your suggested line would disable git additions to the prompt at all. Is this correct?
The result of your commands:
command git rev-parse --abbrev-ref @'{u}' 0,00s user 0,00s system 1% cpu 0,332 total
command git rev-list --left-right --count HEAD...@'{u}' 0,00s user 0,00s system 0% cpu 0,656 total
command git rev-parse --show-toplevel 0,00s user 0,00s system 2% cpu 0,183 total
I acces my home folder on the university server from my macbook to edit different projects which are kept under version control. It is a very convenient and seamless method of working from my macbook. I don't need to sync anything. I can spontaneously edit a different file without having to configure something. I can use my own version of tex compiler, macvim, the pdf viewer skim, dash.app (all the osx gui apps I don't have on the linux machine in the university, only on my laptop).
The home folder in the university is professionally backuped. It is a safe place to keep my files. If my macbook hard drive crashes, I don't lose anything. Compare also http://stackoverflow.com/questions/7245837/using-git-over-sshfs-is-too-slow
To cut the story short, I currently use liquidprompt which does what I want, but offers too many features I don't use.
I just thought that there are many people who like sshfs and would consider using your zsh prompt as well. If you don't use sshfs and don't see any gain in sshfs, I can understand that your not interested in this.
Sorry, if I haven't tried the pure prompt properly in the beginning. I have used https://github.com/Eriner/zim/wiki/Themes to test different prompts (eriner gitster liquidprompt minimal pure steeef). It appears to be that currently pure prompt does only show the git infos in local git repos. And if I am in sshfs mounted repo no git info is shown. Of course, I can check the git status with $ git status.
Does the pure plugin have already a tight timeout to stop querying very early git to ship out the prompt?
Wrong, I had commented the vcs_info line. Sorry for the clutter.
Commenting your suggested line would disable git additions to the prompt at all. Is this correct?
Yup, correct!
The result of your commands:
Wow, those commands alone added up to ~1 second. Thanks for the input, I'll definitely put this under consideration. I have a couple of ideas but will need to think about this a bit more, if possible I'd like to not introduce any new configuration settings. If I do make this a setting I would like to somehow incorporate it with the option for disabling git status checking for large repos.
For now, if it satisfies you, you can make the following change to your local pure.
diff --git a/pure.zsh b/pure.zsh
index a061851..1215c9b 100644
--- a/pure.zsh
+++ b/pure.zsh
@@ -205,8 +205,15 @@ prompt_pure_precmd() {
# shows the full path in the title
prompt_pure_set_title 'expand-prompt' '%~'
+ local skip_vcs_info=0
+ local dir MATCH
+ for dir in $PURE_GIT_DISABLE; do
+ [[ $PWD =~ ^$dir(/.*)?$ ]] && skip_vcs_info=1
+ done
+ unset dir MATCH
+
# get vcs info
- vcs_info
+ (( ! skip_vcs_info )) && vcs_info
# preform async git dirty check and fetch
prompt_pure_async_tasks
With this change you can disable git checks for a specific path and all its subdirectories like to:
PURE_GIT_DISABLE=(/Users/user/path/to/sshfs /Users/user/other/place)
This disables e.g. /Users/user/path/to/sshfs and also /Users/user/path/to/sshfs/some/sub/path, same goes for /Users/user/other/place and all its subdirectories.
Thanks for your code snippet. This will suit my needs. I will add it to my local version. Thanks for your help.
Maybe following setting of zsh itself could be useful:
zstyle ':vcs_info:*' disable-patterns "$HOME/ssh-mount"
SOLVED
Actually, the snippet zstyle ':vcs_info:*' disable-patterns "$HOME/ssh-mount" does already what I was looking for. So no need for PURE_GIT_DISABLE.
This could be added to the faq.
Nice find, thank you. Your version will not work for sub directories, though, here's a fix for that:
zstyle ':vcs_info:*' disable-patterns "$HOME/ssh-mount(|/*)"
Most helpful comment
Nice find, thank you. Your version will not work for sub directories, though, here's a fix for that: