Skip to content
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

Show status flag of repo in statusline #219

Closed
wants to merge 2 commits into from

Conversation

elien122
Copy link

@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.

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
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': ''}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@blueyed
Copy link
Contributor

blueyed commented Dec 13, 2014

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

@tpope
Copy link
Owner

tpope commented Aug 15, 2019

If this does happen, it would require an all new implementation at this point, 7 years in the future. Let's make #206 the umbrella issue.

@tpope tpope closed this Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants