Show status flag of repo in statusline #219

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
@elien122

elien122 commented Jul 3, 2012

This is customizing the fugitive statusline for showing status flags which indicate current repository status.
like $(__git_ps1) of git-completion.bash in linux shell.

I wrote this tweak a couple of month ago just for my taste.
By chance i stopped by your github site, and i saw someone who needs this feature.
(issue #206, #197)

Tested on WinXP-x86, Ubuntu-2.6.32.32-x64. Vim version on both platform is 7.3.566
I hope this will help.

elien122 added some commits Jul 3, 2012

Show status flag of repo in statusline
Status flags of .git repository are shown next to the branch name as
below.
  [master*+$%]

Try to mimic '$(__git_ps1 " (%s)")' of 'git-completion.bash'
(GIT_PS1_SHOWDIRTYSTATE / GIT_PS1_SHOWSTASHSTATE / GIT_PS1_SHOWUNTRACKEDFILES)

  # dirty_flag - '*': modified, but not staged flag
                 '+': staged (to be committed) flag
  # stash_flag - '$': something is stashed
  # untracked  - '%': there're untracked files

In vim, checking repo_status is done by calling 'git' externally,
vim-user can be tormented with severe performance degradations.
Accordingly, makes status checking as less as possible - only when
.git/index is modified, and files in .git work tree are modified.

To enable this feature, declare below variables somewhere in vimrc

    let g:fugitive_stl_showdirtystate = 1
    let g:fugitive_stl_showstashstate = 1
    let g:fugitive_stl_showuntrackedfiles = 1
Combine repo_state variables into one Dictionary
Several variables which contain the repo status are combined into single
Dictionary.

Also, git_index_mod_time_old gets changed its type into buffer(b:) due
to support the situation when multiple 'index' files exist in one work
tree, such as submodule.
+
+"initialize variables for repo_status_flag on statusline
+" to enable status_flag feature declare below 'g:fugitive_stl_show...' variables somewhere in your vimrc setting
+let s:repo_state = {'dirty': {'unstaged': '' , 'staged': ''}, 'stash': '' , 'untracked': ''}

This comment has been minimized.

@stardiviner

stardiviner Oct 2, 2012

Seems there are some status not implemented ?? check out here

@stardiviner

stardiviner Oct 2, 2012

Seems there are some status not implemented ?? check out here

@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed Dec 13, 2014

Contributor

@elien122
Do you still use this? Have you improved it?

Contributor

blueyed commented Dec 13, 2014

@elien122
Do you still use this? Have you improved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment