zsh-users
 help / color / mirror / code / Atom feed
* vcs_info : git, hg, svn, fossil, etc.
@ 2012-09-20 20:45 Gautier DI FOLCO
  2012-09-21 23:49 ` Baptiste Daroussin
  0 siblings, 1 reply; 3+ messages in thread
From: Gautier DI FOLCO @ 2012-09-20 20:45 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 2137 bytes --]

Hi all,

I'm new to zsh and to this ML, so I have few questions.
To begin I'm running zsh 4.3.17 (i386-redhat-linux-gnu) on a fedora 17-i686,
I use oh-my-zsh, but I'm a bit limited by the lack of support from other VCS
that git, I also use svn, hg, fossil, so I search and I find vcs_info! I
fall in love
of zsh again. So I edit my them to have the following thing :
#!/usr/bin/env zsh

# Set required options.
setopt promptsubst

# Load required modules.
autoload -U add-zsh-hook
autoload -Uz vcs_info

# Add hook for calling vcs_info before each command.
add-zsh-hook precmd vcs_info

# Set vcs_info parameters.
zstyle ':vcs_info:*' enable hg bzr git svn fossil
zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos.
zstyle ':vcs_info:*:*' unstagedstr '!'
zstyle ':vcs_info:*:*' stagedstr '%B%{$fg[green]%} ✚%{$reset_color%}'
zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)"
zstyle ':vcs_info:*:*' formats "%c" "[|%i]
%B%{$fg[blue]%}%s:%{$fg[red]%}%b%{$reset_color%}"
zstyle ':vcs_info:*:*' nvcsformats "" ""
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b'

PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[red]%}➜
%{$reset_color%}'

ZSH_THEME_GIT_PROMPT_PREFIX="git:%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

RPROMPT='${vcs_info_msg_0_}
${vcs_info_msg_1_}${return_status}$(git_prompt_status)
$(git_time_since_commit)%{$reset_color%}'

It doesn't work :

   - Git is well supported (because it is part of omz)
   - Branches aren't supported for svn (only the root directory is printed)
   - Hg last commit doesn't appear
   - Fossil is not supported at all


My goal is to have a rprompt with (in order) a maximum of informations about
the repository (add, remove, modified, etc. files), the date of the last
commit,
the last commit id, the vcs name and the branch.
Have the same information for svn, hg, git or fossil.

Is it possible to do it simply? where I'm wrong in my code?

For your help,
In advance,
Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: vcs_info : git, hg, svn, fossil, etc.
  2012-09-20 20:45 vcs_info : git, hg, svn, fossil, etc Gautier DI FOLCO
@ 2012-09-21 23:49 ` Baptiste Daroussin
  2012-10-09 14:58   ` Gautier DI FOLCO
  0 siblings, 1 reply; 3+ messages in thread
From: Baptiste Daroussin @ 2012-09-21 23:49 UTC (permalink / raw)
  To: Gautier DI FOLCO; +Cc: zsh-users

2012/9/20 Gautier DI FOLCO <gautier.difolco@gmail.com>:
> Hi all,
>
> I'm new to zsh and to this ML, so I have few questions.
> To begin I'm running zsh 4.3.17 (i386-redhat-linux-gnu) on a fedora 17-i686,
> I use oh-my-zsh, but I'm a bit limited by the lack of support from other VCS
> that git, I also use svn, hg, fossil, so I search and I find vcs_info! I
> fall in love
> of zsh again. So I edit my them to have the following thing :
> #!/usr/bin/env zsh
>
> # Set required options.
> setopt promptsubst
>
> # Load required modules.
> autoload -U add-zsh-hook
> autoload -Uz vcs_info
>
> # Add hook for calling vcs_info before each command.
> add-zsh-hook precmd vcs_info
>
> # Set vcs_info parameters.
> zstyle ':vcs_info:*' enable hg bzr git svn fossil
> zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos.
> zstyle ':vcs_info:*:*' unstagedstr '!'
> zstyle ':vcs_info:*:*' stagedstr '%B%{$fg[green]%} ✚%{$reset_color%}'
> zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)"
> zstyle ':vcs_info:*:*' formats "%c" "[|%i]
> %B%{$fg[blue]%}%s:%{$fg[red]%}%b%{$reset_color%}"
> zstyle ':vcs_info:*:*' nvcsformats "" ""
> zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b'
>
> PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[red]%}➜
> %{$reset_color%}'
>
> ZSH_THEME_GIT_PROMPT_PREFIX="git:%{$fg[red]%}"
> ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
> ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}%{$reset_color%}"
> ZSH_THEME_GIT_PROMPT_CLEAN=""
>
> RPROMPT='${vcs_info_msg_0_}
> ${vcs_info_msg_1_}${return_status}$(git_prompt_status)
> $(git_time_since_commit)%{$reset_color%}'
>
> It doesn't work :
>
>    - Git is well supported (because it is part of omz)
>    - Branches aren't supported for svn (only the root directory is printed)
>    - Hg last commit doesn't appear
>    - Fossil is not supported at all

For fossil the thing is that  VCS_INFO_detect_fossil is only looking
for _FOSSIL_ file but now on unix by default it should be looking for
.fslckout

To make this work, edit the file, change:
vcs_comm[detect_need_file]=_FOSSIL_
to
vcs_comm[detect_need_file]="_FOSSIL_ .fslckout"

And it will work.

Tested and approved here :)

regards,
Bapt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: vcs_info : git, hg, svn, fossil, etc.
  2012-09-21 23:49 ` Baptiste Daroussin
@ 2012-10-09 14:58   ` Gautier DI FOLCO
  0 siblings, 0 replies; 3+ messages in thread
From: Gautier DI FOLCO @ 2012-10-09 14:58 UTC (permalink / raw)
  To: Baptiste Daroussin; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

2012/9/22 Baptiste Daroussin <baptiste.daroussin@gmail.com>

> For fossil the thing is that  VCS_INFO_detect_fossil is only looking
> for _FOSSIL_ file but now on unix by default it should be looking for
> .fslckout
>
> To make this work, edit the file, change:
> vcs_comm[detect_need_file]=_FOSSIL_
> to
> vcs_comm[detect_need_file]="_FOSSIL_ .fslckout"
>
> And it will work.
>
> Tested and approved here :)
>
> regards,
> Bapt
>

It works, I have some troubles with git and hg for recieving the commit id,
but
I think I have a pretty old version of zsh.

Thanks for your help.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-09 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-20 20:45 vcs_info : git, hg, svn, fossil, etc Gautier DI FOLCO
2012-09-21 23:49 ` Baptiste Daroussin
2012-10-09 14:58   ` Gautier DI FOLCO

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).