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

Update vim-statuslines.md #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dhallmark
Copy link

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
Owner

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

@LazyScholar
Copy link

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