Skip to content

Update vim-statuslines.md#10

Open
dhallmark wants to merge 1 commit intoshapeshed:mainfrom
dhallmark:patch-1
Open

Update vim-statuslines.md#10
dhallmark wants to merge 1 commit intoshapeshed:mainfrom
dhallmark:patch-1

Conversation

@dhallmark
Copy link
Copy Markdown

The current GitBranch function will display a branch name for the current directory where Vim was launched even if a file is opened in a different directory outside of the git repository. For example, when editing my ~/.vimrc the status line showed a git branch of "master" even though my .vimrc file in my home directory is not a part of a git repository. This revision changes the command to cd to the open file's directory and detects the branch name from there.

Also noted that command assumes the current file being edited is actually a committed member of the branch.

The current GitBranch function will display a branch name for the current directory where Vim was launched even if a file is opened in a different directory outside of the git repository.  For example, when editing my ~/.vimrc the status line showed a git branch of "master" even though my .vimrc file in my home directory is not a part of a git repository.  This revision changes the command to cd to the open file's directory and detects the branch name from there.  

Also noted that command assumes the current file being edited is actually a committed member of the branch.
@shapeshed
Copy link
Copy Markdown
Owner

Thanks very much for your contribution. I need a little time to review this in different shells!

@LazyScholar
Copy link
Copy Markdown

Consider to change the call to the function GitBranch() as the constant updating might clutter the screen as mentioned here. @shapeshed

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.

3 participants